1) Download existing code and database and put code into htdocs and import sql file or if it is new setup, follow this url.
https://framework.themosis.com/docs/2.0/installation/
2) If wp_options has different domain on production, Use same domain in virtualhost for local setup.
3) Point the domain upto htdocs (folder inside project root dir) and open it in browser.
4) If you get error
Unable to define the environment. / Unable to locate your environment configuration file. / Missing environment variables. / Error establishing a database connectionSolution :
Add your server's hostname in xyz.com/config/environment.php as a production value. In my case it is localserver.
<?php
return array(
'local' => ['xyz.local', 'xyz2.local'],
'staging' => 'dev.xyz.co.uk',
'production' => ['ip-172-16-150-95.eu-west-1.compute.internal', 'ip-172-31-13-11.eu-west-1.compute.internal', 'localserver']
);
5) Now if you get db connection error 'Error establishing a database connection'
Put correct database credentials and correct urls in xyz.com/.env.production.php
<?php
return [
'DB_NAME' => 'xyz',
'DB_USER' => 'admin',
'DB_PASSWORD' => 'password',
'DB_HOST' => 'localhost',
'WP_HOME' => 'http://xyz.com',
'WP_SITEURL' => 'http://xyz.com/cms',
'DEV_EMAIL' => 'developer@xyz.co.uk',
'DEV_NAME' => 'developer',
]
6) If errors are resolved but it opens blank page in place of site, change owner of complete project to apache or www-data depends on it is centos or ubuntu.
sudo chown -R apache:apache xyz.comIt is not able to create files in xyz.com/storage/views, that's why you are getting blank page once necessary files are created, site can be opened.
7) After doing all above things but still you get 'Error establishing a database connection'. Check if you have created wp-config.php inside cms folder.
This creation is the reason of database connection error. There should be only one wp-config.php and it is in xyz.com/htdocs/wp-config.php
wp-admin Details :
http://xyz.co.in/cms/wp-login.php8) Fix issue 'Error establishing a database connection' in existing setup.
Username - admin
Password - xxxxxxxxxxxxx
cd xyz.comRemove same domain from staging and production.
nano config/environment.php
nano .env.production.phpMake credentials and DB Variable correct.
rm htdocs/cms/wp-config.php
nano config/environment.php
chown -R apache:apache storage/views/