Apache has a graceful
option which can scan for modification in http.conf
without restarting Apache. What about nginx?
Asked
Active
Viewed 9.5k times
5 Answers
144
Use nginx -s reload

Ethan Cane
- 1,449
- 1
- 8
- 2
-
7^This 100%. Worked a charm. – Sep 26 '13 at 12:00
-
1This didn't take http basic authentication changes into effect for me. – Nick Rolando Mar 04 '16 at 00:29
-
This should be the accepted answer. – John Foley Nov 29 '16 at 17:00
85
nginx supports the following signals :
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 is what you are looking for, so sudo kill -HUP pid (nginx pid)
-
2I like the [answer below](https://serverfault.com/a/108750/561691) better. – Obay Abd-Algader Nov 29 '20 at 13:01
23
Usually nginx's init-script has reload
action, i.e:
- Linux
/etc/init.d/nginx reload
- FreeBSD
/usr/local/etc/rc.d/nginx reload

SaveTheRbtz
- 5,691
- 4
- 32
- 45
-2
I wrote about how to restart nginx with zero downtime a while ago. This may be helpful for you.
http://tumblelog.jauderho.com/post/101514948/restart-nginx-with-zero-downtime

Jauder Ho
- 5,507
- 2
- 19
- 17