Skip to content

Instantly share code, notes, and snippets.

@everaldo
Created July 18, 2013 15:45
Show Gist options
  • Save everaldo/6030414 to your computer and use it in GitHub Desktop.
Save everaldo/6030414 to your computer and use it in GitHub Desktop.
upgrading Nginx Gracefully
Replace the old Nginx binary (by default, /usr/local/nginx/sbin/nginx) with the new one.
Find the pid of the Nginx master process, for example, with ps x | grep nginx | grep master or by looking at the value found in the pid file.
Send a USR2 (12) signal to the master process kill USR2 ***, replacing *** with the pid found in step 2. This will initiate the upgrade by renaming the old .pid file and running the new binary.
Send a WINCH (28) signal to the old master process kill WINCH ***, replacing *** with the pid found in step 2. This will engage a graceful shutdown of the old worker processes.
Make sure that all the old worker processes are terminated, and then send a QUIT signal to the old master process kill QUIT ***, replacing *** with the pid found in step 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment