# Nginx信号管理 [TOC] Nginx的信号管理命令为:`kill -参数 Nginx进程号` 例如:`kill -HUP $(cat /usr/local/nginx/logs/nginx.pid)` [官方参考地址](https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/) |参数|解释| |-|-| | TERM, INT | Quick shutdown | | QUIT | Graceful shutdown(优雅关闭进程,等请求结束后再关闭) | | KILL | Halts a stubborn process | | HUP | Configuration reload,Start the new worker processes with a new configuration,Gracefully shutdown the old worker processes(改变配置文件,平滑重读配置文件)| | USR1 | Reopen the log files(重读日志,可在日志切割时使用) | | USR2 | Upgrade Executable on the fly(平滑升级) | | WINCH | Gracefully shutdown the worker processes(优雅关闭旧的进程) | ## Nginx的优雅重启配置 ~~~ /usr/local/nginx/sbin/nginx -s reload /usr/local/nginx/sbin/nginx -HUP `cate /usr/local/nginx/logs/nginx.pid` ~~~ ## Nginx的日志切割命令 ~~~ /usr/local/nginx/sbin/nginx -s reopen /usr/local/nginx/sbin/nginx -USR1 `cate /usr/local/nginx/logs/nginx.pid` ~~~