3

I believe I have an error in one of my nginx configs. I have tried:

$ sudo service nginx restart
* Restarting nginx nginx [fail] 
$

After some googling i then tried the following:

$ sudo service nginx -t
Usage: nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}

but it only shows the list of commands. There are no messages about config errors in the nginx log or syslog. How i can get more detailed error message?

1 Answer 1

8

The command you are looking for is:

nginx -t

i.e. when confronted with:

$ sudo su # if necessary
$ service nginx restart
* Restarting nginx nginx [fail] 

Then use nginx -t:

$ sudo su # if necessary
$ nginx -t
nginx: [emerg] unknown directive "i" in /etc/nginx/nginx.conf:120
nginx: configuration file /etc/nginx/nginx.conf test failed
1
  • Nice, "don't drink and google". Need badge "drunk stupid question".
    – Hayate
    Dec 14, 2014 at 2:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .