By steroyle
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;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.