It’s important to keep your Nginx server up when you try to upgrade your Nginx to a newer version. I tried following steps successfully.

  1. Check the compile configuration for previous version:
/usr/local/nginx/sbin/nginx -V
  1. Configure the new version according to the previous configuration and your need.

  2. Compile and install

make & make install
  1. Send USR2(12) signal to the master process:
kill -USR2 `cat /usr/local/nginx/logs/`

A new file name appeared in /usr/local/nginx/logs/.

  1. Send WINCH(28) signal to master process in order to shutdown the worker process gracefully:
kill -WINCH `cat /usr/local/nginx/logs/`
  1. Send QUIT signal to shutdown the master process:
kill -QUIT `cat /usr/local/nginx/logs/`

Now the nginx server should have been upgraded gracefully.