How to make a modification take affect without restarting nginx?

Solution 1:

Use nginx -s reload

Solution 2:

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


Solution 3:

Usually nginx's init-script has reload action, i.e:

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

Solution 4:

service nginx reload ?

P.S. Doesn't work on Windows.

Tags:

Nginx