# 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`
~~~