0

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

Bastien974
  • 1,824
  • 12
  • 43
  • 61

1 Answers1

2

http://nginx.org/en/docs/control.html

Try to use TERM or INT instead of KILL. KILL is too "fast", it doesn't give nginx's master a chance to stop workers.

Alexey Ten
  • 7,922
  • 31
  • 35