Mastering Nginx

(Ron) #1
Chapter 8

[ 195 ]

www 36663 0.0 0.2 20900 11992 ?? S 12:52PM 0:00.18 nginx: worker
process (nginx)
root 50725 0.0 0.1 18844 8408 ?? I 3:49PM 0:00.05 nginx: master
process /usr/local/sbin/nginx
www 50726 0.0 0.1 18844 9240 ?? I 3:49PM 0:00.00 nginx: worker
process (nginx)
www 50727 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)
www 50728 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)
www 50729 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)


  1. Send the old NGINX master process a WINCH signal to tell it to stop
    handling new requests, and phase out its worker processes once they
    are done with their current requests:

    kill -WINCH cat /var/run/nginx.pid.oldbin




You'll get the following response output:
root 1149 0.0 0.2 20900 11768 ?? Ss Fri03PM 0:00.14 nginx: master
process /usr/local/sbin/nginx
root 50725 0.0 0.1 18844 8408 ?? I 3:49PM 0:00.05 nginx: master
process /usr/local/sbin/nginx
www 50726 0.0 0.1 18844 9240 ?? I 3:49PM 0:00.00 nginx: worker
process (nginx)
www 50727 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)
www 50728 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)
www 50729 0.0 0.1 18844 9240 ?? S 3:49PM 0:00.01 nginx: worker
process (nginx)


  1. Send the old NGINX master process a QUIT signal, once all its worker
    processes have ended, and we will have only the new nginx binary
    running, responding to requests:

    kill -QUIT cat /var/run/nginx.pid.oldbin




If there is any problem with the new binary, we can roll back to the old one before
sending the QUIT signal to the old binary:


# kill -HUP `cat /var/run/nginx.pid.oldbin`
# kill -QUIT `cat /var/run/nginx.pid`
Free download pdf