如何nginx配置更新,而无需重新加载或重新启动nginx

use*_*381 5 nginx

我希望Nginx更新配置文件,而无需重新加载或重新启动Nginx.它似乎是API或任何东西(http://nginx.com/products/on-the-fly-reconfiguration/).

Bra*_*ldt 11

在Ubuntu或Debian上,它就像使用reload参数一样简单:

service nginx reload
Run Code Online (Sandbox Code Playgroud)

官方的方式是发送SIGHUP:

kill -HUP $(ps -ef | grep nginx | grep master | awk '{print $2}')
Run Code Online (Sandbox Code Playgroud)

上面的命令将获取nginx主进程的进程ID并向其发送SIGHUP信号.

请参阅Nginx控制Nginx文档.

您还可以使用Nginx二进制文件:

nginx -s reload
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考,此处记录了 `-s reload` 命令:http://nginx.org/en/docs/switches.html。 (2认同)