nginx -s signal
Where signal may be one of the following:
- stop — fast shutdown
- quit — graceful shutdown 只能是启动者使用
- reload — reloading the configuration file 更改完配置文件之后优雅地重新读取配置文件
- reopen — reopening the log files
也可以使用Linux上的kill命令来关闭 nginx
先查出nginx的进程号:ps -ax | grep nginx
97641 ? Ss 0:00 nginx: master process /usr/local/nginx/nginx
97642 ? S 0:00 nginx: worker process
97674 pts/1 S+ 0:00 grep --color=auto nginx
很明显第二个97642就是nginx的进程号了,用kill -s QUIT 97642 即可关闭nginx了
(记住每次启动nginx的进程号都是不一样的,另外Linux上是严格区分大小写的)