Report this

What is the reason for this report?

Debugging nginx server block configuration

Posted on July 14, 2015

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.