10

Can I set a new virtual host using the server object in the nginx.conf configuration file, without restarting the server (and without closing the active connections)?

Thanks

Mark
  • 67,098
  • 47
  • 117
  • 162

2 Answers2

18

Yes you can.

nginx -s reload

Or you can send SIGHUP to the nginx process.

sudo kill -HUP [nginx's pid]

Robbie Wxyz
  • 7,671
  • 2
  • 32
  • 47
Timofey Stolbov
  • 4,501
  • 3
  • 40
  • 45
1

You can Load New Configuration Using Signals. It will

  1. Read and test a new configuration. If the configuration invalid then do nothing.
  2. When valid, start new processing workers with new configuration. Attach new workers to port listening, log, etc.
  3. Detach old workers from listeners.
  4. Gracefully shutdown old workers.

You can even Upgrade To a New Binary On The Fly. See the same doc.

To perform the reload, send the reload signal:

nginx -s reload
Dmitry Kaigorodov
  • 1,512
  • 18
  • 27