Nginx - Can I add a new virtual host without restarting the server?

Is it possible to install a new virtual host using the server object in the nginx.conf configuration file without restarting the server (and without closing active connections)?

thanks

+8
nginx virtualhost configuration restart
source share
2 answers

Yes, you can.

nginx -s reload

Or you can send SIGHUP to the nginx process.

sudo kill -HUP [nginx pid]

+15
source share

You can load a new configuration using signals . Will be

  1. Read and test the new configuration. If the configuration is incorrect, then do nothing.
  2. When this is true, start working with new workers with a new configuration. Connect new workers to port listening, registration, etc.
  3. Disconnect old workers from students.
  4. Gracefully shut down the old workers.

You can even upgrade to a new binary on the fly. See the same document.

To reboot, send a reload signal:

 nginx -s reload 
0
source share

All Articles