When restarting the php-fpm service on my Linux system, the PHP CGI process take a while to shutdown completely. Until it does, trying to start a new PHP CGI instance fails because port 9000 is still held by the terminating process. Accessing the site during this time results in a 502 Gateway Error, which I'd like to avoid.
How can I restart php-fpm smoothly without getting this error?
Run two instances of php-fpm, describe it in one upstream section.
upstream fast_cgi { server localhost:9000; server localhost:9001 backup; }
Change nginx.conf, to use fastcgi_pass fast_cgi;
.
After that, if you restart one instance, nginx will process request through second php-fpm instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With