如何在不重启nginx的情况下使修改生效?


74

Apache有一个graceful选项,可以扫描修改http.conf而无需重新启动Apache。那nginx呢?

Answers:


72

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

HUP是您想要的,所以 sudo kill -HUP pid (nginx pid)

来源:http : //nginx.org/en/docs/control.html



20

通常,nginx的init-script具有reload作用,即:

  • 的Linux /etc/init.d/nginx reload
  • FreeBSD /usr/local/etc/rc.d/nginx reload


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.