Como fazer uma modificação ter efeito sem reiniciar o nginx?

74

O Apache possui uma gracefulopção que pode procurar por modificações http.confsem reiniciar o Apache. E o nginx?

vps
fonte

Respostas:

72

O nginx suporta os seguintes sinais:

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 é o que você está procurando, então sudo kill -HUP pid (nginx pid)

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

Razique
fonte
90

Use nginx -s reload

Ethan Cane
fonte
4
^ 100%. Trabalhou um encanto.
meshfields
1
Isso não levou em conta as alterações básicas de autenticação http.
Nick Rolando
Essa deve ser a resposta aceita.
John Foley
20

Normalmente, o script init do nginx tem reloadação, ou seja:

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

service nginx reload ?

PS Não funciona no Windows.

anatoly techtonik
fonte