# Nginx doesn't recognize command

**URL:** <https://www.ruby-forum.com/t/nginx-doesnt-recognize-command/203775>\
**Category:** NGINX\
**Created:** [February 27, 2011, 1:28am UTC](https://www.ruby-forum.com/t/nginx-doesnt-recognize-command/203775 "2011-02-27T01:28:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 27, 2011, 1:28am UTC](https://www.ruby-forum.com/t/nginx-doesnt-recognize-command/203775/1 "2011-02-27T01:28:23Z")

</div>

I was following the tutorial here:  
[http://articles.slicehost.com/2009/2/2/centos-installing-nginx-from-source](http://articles.slicehost.com/2009/2/2/centos-installing-nginx-from-source)  
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??

---

<div class="post-metadata">

**Author:** ![aditya\_h](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@aditya\_h](https://www.ruby-forum.com/u/aditya_h)\
**Post date:** [February 27, 2011, 2:54am UTC](https://www.ruby-forum.com/t/nginx-doesnt-recognize-command/203775/2 "2011-02-27T02:54:03Z")

</div>

Hello!

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

> I was following the tutorial here:  
> [http://articles.slicehost.com/2009/2/2/centos-installing-nginx-from-source](http://articles.slicehost.com/2009/2/2/centos-installing-nginx-from-source)  
> 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/nginx.pid`

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:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.
