By roberto
Hi,
I have followed the guide on https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3 . For one virtual host, it works correctly. But when I’ve tried to add the 2nd, the new /etc/nginx/sites/available/ config file has not been recognized by nginx (I’m getting the content from the other domain). Somehow, if I remove the config file for the first host I created, the new one starts working. So I suppose there’s a conflict between both.
Both sites-available config files have the same structure:
server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/mydomain.com/public_html/;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name mydomain.com;
access_log /var/log/nginx/mydomain.com.access.log;
error_log /var/log/nginx/mydomain.com.error.log;
}
Any suggestion please?
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!
Thanks Pablo, that seems to be in order - both domains have their respective symbolic links from /etc/nginx/sites-enabled/* to /etc/nginx/sites-available/*
In the tutorial, make sure to complete the 2nd-to-last paragraph in <b>Step Five—Set Up the Virtual Hosts</b> (i.e. create a symbolic link to the <code>/etc/nginx/sites-enabled/</code> directory, for EACH domain).
It’s weird, it has started working again, and I think I didn’t touch anything. I’ll perform a backup, just in case I don’t touch anything else and stops working once again :-D <br> <br>I’m serious, I think I didn’t touch anything :-/
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.