Nginx的信號控制及命令控制
Kill -信號選項 nginx的主進程號
信號選項 | 描述 |
---|---|
TERM, INT | Quick shutdown 立刻關閉 |
QUIT | Graceful shutdown 優雅的關閉進程,即等請求結束後再關閉 |
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 優雅關閉舊的進程(配合USR2來進行升級) |
用法:
Kill -信號控制 `cat /xxx/path/log/nginx.pid`
重新載入配置文件
信號控制
Kill -HUP `cat /xxx/path/log/nginx.pid`
命令控制
./sbin/nginx -s reload
關閉
信號控制
Kill -QUIT `cat /xxx/path/log/nginx.pid`
命令控制
./sbin/nginx -s stop
重讀日誌
信號控制
Kill -USR1 `cat /xxx/path/log/nginx.pid`
命令控制
./sbin/nginx -s reopen
平滑的升級
信號控制
Kill -USR2 `cat /xxx/path/log/nginx.pid`
優雅關閉舊的進程
信號控制
Kill -WINCH `cat /xxx/path/log/nginx.pid`