Question
Debugging nginx server block configuration
Hello,
I’m trying to set up a very basic configuration to put a static website online.
I have a domain registered and I configured the nameserver on the domain provider and added it to the droplet.
I followed this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts
and created a virtual host configuration for the website exactly like in the tutorial. It doesn’t work, I just get an “Unable to connect” error. I also made sure to remove the “default” configuration from the sites-enabled directory, but still the same.
I decided to go back to the basics and started reading this guide: https://www.nginx.com/resources/admin-guide/nginx-web-server/
I managed to make it working just with these lines inside nginx.conf
:
server {
server_name example.com;
location / {
root /var/www/example.com;
}
}
I want to be able to put the configuration in separate files inside sites-availabel, though, so I tried again copying just the above lines, but nothing. Also, when the page fails to load nothing gets logged.
I checked the configuration with sudo nginx -t
and it says it’s ok. Where and how can I start debugging it?
Thanks for your help
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.
×