I am currently setting up a VPS (with VPS.NET) which I will be using to host a blog and some other stuff. I've installed nginx, and patched php (5.2.8) with php-fpm.
All works great (and extremely fast!), apart from one annoying issue: because the website has no other traffic than mine for now, after a while it has been in idle all the php-cgi processes die. As soon as I then try to visit the website, nginx returns a nice "502 bad gateway", and to fix I have to manually restart php-fpm to get the website to work again.
Why is that?
I have seen this is somehow a common problem but after a few days looking for a solution in my spare time, I have found none that works for me.
Any suggestions?
Thanks in advance
Best Answer
I am running a very similar set up (nginx 0.7.61, php+fpm 5.2.10) and my PHP processes never die, even after being idle.
The process control bits of my php-fpm.conf are as follows:
Note that while I have the apache-like bits defined (they were part of the default config), they aren't used because I have PM style static set.
You can turn up the logs to debug level using this in the global options section:
to see if there's a reported reason that it's shutting down workers.
A latch-ditch fix if this doesn't work would be to have a service like pingdom hit a php on your site every x minutes, but my experience with this software combo doesn't suggest that this should be required.