I have 2 sites and I want to create a separate config files for each, I have created the 2 configs and a symlink for each.
The problem is both domains show the same page rather than going to their own separate pages:
*** Config 1 ***
server { listen 80;
server_name www.domain1.co.uk; root /var/www/domain1.co.uk;
index index.php index.html index.htm;
location / { try_files $uri $uri/ /index.html; }
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/domain1.co.uk; }
location ~ .php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
*** Config 2 ***
server { listen 80;
server_name www.domain2.co.uk; root /var/www/domain2.co.uk;
index index.php index.html index.htm;
location / { try_files $uri $uri/ /index.html; }
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/domain2.co.uk; }
location ~ .php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Sweet, glad you figured it out :] It usually says it in the error logs which are found in /var/log.
I’ve fixed this now, in case anyone has the same problem as me it was to do with “server_names_hash_bucket_size 64;” in /etc/nginx/nginx.conf. <br> <br>That line was commented out by default so I uncommented and restarted nginx and it works fine now.