Apache 有一个graceful
选项可以在http.conf
不重新启动 Apache 的情况下扫描修改。那么 nginx 呢?
答案1
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)
答案2
使用 nginx -s reload
答案3
通常nginx的init-script会有reload
动作,即:
- Linux
/etc/init.d/nginx reload
- FreeBSD
/usr/local/etc/rc.d/nginx reload
答案4
不久前,我写了一篇关于如何在零停机时间内重启 nginx 的文章。这篇文章可能对你有帮助。
http://tumblelog.jauderho.com/post/101514948/restart-nginx-with-zero-downtime