I have two domain names (e.g. site1.com and site2.com) with CNAMES setup to run the blogs (e.g. blog.site1.com and blog.site2.com). On a separate server I am running VPS (NGINX) server with a mysql-server to run the two wordpress blogs.
The bests guidance I can find is at this link. However, they are using an Apache virtual host. So with Nginx I did the following:
cd /etc/nginx/sites-available
sudo cp default site1.com
sudo cp default site2.com
In the site1.com server block I modified the following:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
#root /usr/share/nginx/html;
root /home/ubuntu/www/blog.site1.com;
index index.php;
server_name blog.site1.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
The similar changes were setup for site2.com nginx server block as well. Then symbolic links were setup for the ~/sites-enabled/ files. Then I changed the wp-config.php for each wordpress directory in site1.com and site2.com.
site1.com (wp-config.php)
/** The name of the database for WordPress */
define('DB_NAME', 'FirstDatabase');
/** MySQL database username */
define('DB_USER', 'FirstUser');
/** MySQL database password */
define('DB_PASSWORD', 'FirstPassword');
site2.com (wp-config.php)
/** The name of the database for WordPress */
define('DB_NAME', 'SecondDatabase');
/** MySQL database username */
define('DB_USER', 'SecondUser');
/** MySQL database password */
define('DB_PASSWORD', 'SecondPassword');
When I navigate to either blog.site1.com or blog.site2.com I see the wordpress installation page.
The problem occurs after I complete the installation for one of the wordpress sites. Even though I have specified separate DB's for each wordpress install instance, both sites show the same wordpress instance. Since the wp-config.php file is clearly showing separate definitions, I am unsure where the error is. Could someone provide guidance for correcting this issue?