I have nginx 1.6.2 wih configuration to upgrade connection to websocket.
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
When no websocket connection is opened, "service nginx stop" works, both master and worker process are gracefully stopped.
killproc $prog -QUIT
But when I have an opened websocket, nginx cannot be stopped, even though I get :
Stopping nginx: [ OK ]
I tried :
killproc $prog -KILL
but as expected, it forcefully kill the master the first time I run the command, and the worker if I re-execute.
What do you recommend for forcing a shutdown on nginx ? I'm thinking of replacing killproc by :
pkill $prog
Best Answer
http://nginx.org/en/docs/control.html
Try to use
TERM
orINT
instead ofKILL
.KILL
is too "fast", it doesn't give nginx's master a chance to stop workers.