Gracefully restart Nginx after changes made in a config file

776px-Nginx-battleship.svgI know how to gracefully restart Apache web server under Unix like operating system. I made changes to nginx.conf. How do I gracefully restart Nginx web server? How do I make changes in a Nginx server config file to take effect without restarting the Nginx server itself without interrupting users’ current session?

From the nginx wiki pages

The master process can handle the following signals: TERM, INT Quick shutdown

  • QUIT Graceful shutdown
  • KILL Halts a stubborn process
  • 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

The syntax is as follows to

OR find nginx pid with the pgrep command or ps command:

Sample outputs:

Type the following command as root user:

If you are using Nginx version 0.7.53+
Pass the -s reload option:

OR

If you are using Debian / CentOS / RHEL / Fedora / Ubuntu Linux try

If you are using FreeBSD try

If you are using OpenBSD try

OR

How do I reload / gracefully restart chrooted nginx server?
Type the following command:

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *