Nginx failing to reload - how to track down why?

Hi I've had my Nginx server running great on Ubuntu server 12.04 for a while.

I've been gradually bolting on various bits, and got as far as optimising load times on my wordpress page.

After making a few changes to my hosts file I decided to:

sudo /etc/init.d/nginx reload

To which I get:

* Reloading nginx configuration nginx                           [fail]

No additional info or reasoning is given. How can I restart my server so that it prints any error statements whilst reloading so I can begin to track down the error.

For a bonus question:

For those Nginx sysadmins, when you've made a bunch of changes to hosts and bolted on a few other bits and suddenly your nginx server won't reload (incidentally everything still appears to be running!) how do you begin your approach to isolating why or begin breaking things down to debug!


Check syslog (/var/log/syslog) for messages about config file issues.

From the commandline you can run:

nginx -c /etc/nginx/nginx.conf -t

to have nginx check your configuration for errors.


Run this command you can find problem.

sudo nginx -t