nginx doesn't recognize command

Maxim Dounin mdounin at
Sun Feb 27 04:51:49 MSK 2011


On Sun, Feb 27, 2011 at 12:26:47AM +0000, Aditya Herlambang wrote:

> I was following the tutorial here:
> and I tried to stop nginx by executing:
> sudo nginx stop at the directory
> and it says:
> invalid option "stop"
> why is it not recognizing the option?? 		 	   		  

Because there is no such option.  If you see somebody running 
"nginx stop" - he probably refer to his operating system startup 
script instead, not nginx itself.

To stop nginx you have to sent SIGTERM to master process (or 
SIGQUIT for graceful shutdown), i.e.

# kill -s TERM `cat /path/to/`

should work.  Alternatively in 0.7.53+ you may use

# nginx -s stop

but this isn't really recommended unless you are under Windows and 
has no other options (as this implies config parsing and may not 
work at all e.g. if you have errors in your config).

See here for more details:

Maxim Dounin

More information about the nginx mailing list