95

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

Bart
  • 103
  • 4
vps
  • 1,187
  • 3
  • 12
  • 12

5 Answers5

135

Use nginx -s reload

Ethan Cane
  • 1,359
  • 1
  • 7
  • 2
84

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

Sam V
  • 129
  • 4
Razique
  • 2,266
  • 1
  • 19
  • 23
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,621
  • 4
  • 29
  • 45
2

service nginx reload ?

P.S. Doesn't work on Windows.

anatoly techtonik
  • 263
  • 1
  • 3
  • 12
-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,337
  • 2
  • 18
  • 17