Restarting nginx backends without losing requests
- by Oli
I'm sure it's been asked before in different words but I run several Django sites via uwsgi (emporer mode) behind nginx. It's all a fairly standard configuration but I find that if I restart the central uwsgi process, nginx just bombs out 502s rather than waiting for the socket to become available.
I recognise that most of this is probably for a reason but people seeing 502 errors really stings me. It's certainly not something I want a client to see. So...
Can I beg nginx to wait/retry backends? Or,
Is there anything (other than the obvious) I can do to minimise commercial damage from uwsgi restarts?