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 -信号选项 nginx的主进程号
Kill -HUP 4873
Kill -信号控制 `cat /xxx/path/log/nginx.pid`
Kill -USR1 `cat /xxx/path/log/nginx.pid`
测试HUP的方法:
1.修改nginx配置文件,让nginx的默认读取的文件修改为别的文件(test.html)
2.index.html和test.html文件都使用js将自身不断的刷新,
3.执行 kill -HUP xx(nginx master pid),观察浏览器的情况
注意:当执行上面的kill命令时,浏览器不会立刻的看到效果,因为js程序在不断的刷新页面,需要等几秒钟才能看到nginx配置文件修改的效果
技巧:
在使用kill命令时,如果想将pid用别的方式代替,其实在logs目录下,nginx.pid就是存放nginx master pid,
所以kill -HUP nginx master pid == kill -HUP `cat nginx.pid` (注意:这里的引号是单反引号)
nginx -s reload 重载配置文件
nginx -s reopen 重新打开日志
nginx -s stop 关闭nginx
nginx -s quit 优雅的关闭nginx
nginx -t 检查nginx配置文件是否出错