93

Apache has a graceful option which can scan for modification in http.conf without restarting Apache. What about nginx?

5 Answers 5

83

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)

source : http://nginx.org/en/docs/control.html

1
130

Use nginx -s reload

3
  • 5
    ^This 100%. Worked a charm.
    – user54883
    Sep 26, 2013 at 12:00
  • 1
    This didn't take http basic authentication changes into effect for me. Mar 4, 2016 at 0:29
  • This should be the accepted answer.
    – John Foley
    Nov 29, 2016 at 17:00
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
2

service nginx reload ?

P.S. Doesn't work on Windows.

-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

2
  • 8
    Your blog thing has no actual information.
    – Geuis
    Jun 20, 2013 at 7:32
  • 2
    USR2 is for upgrading the executable, not for simple config reloading.
    – Brad
    May 22, 2014 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.