Nginx, php5.cgi, supervisord and 502 errors

Does anyone have a working Nginx+php.cgi configuration? are you using supervisord?

I recently switched my drupal sites hosted on DH from Apache to Nginx. The performance is way better but I encountered a problem of PHP crashing shortly after midnight and not being respawned.

This has been reported already in threads like this one and this one but as they are rather old and limitedly touch on supervisord, I’m opening a new thread.

I contacted DH support and they installed supervisord for me that was supposed to solve the problem. It did solve the problem for a while but then, probably due to a server update or something like that, I found that my server was running php processes spawned by supervisord as well as processes spawned by a startup script. Only the ones from supervisord were actually serving my visitors, the others were just sitting and eating up memory.

Along with this I also started having the 502 errors again every day shortly after midnight. It seems that a script somewhere is killing supervisord as well as my php processes.

Does anyone have a functioning experience with nginx and php on DH?

I have a script I run to check my VPS servers every 5 minutes. When it hits a 502 or 504 error, it simply reboots the VPS machine. It’ll only reboot once per hour, but generally a single reboot is all it takes to get it back online for me. Out of the 6 VPS machines I run for various people, I see 3-4 reboots a week from the monitor.

I know… sucks that you have to monitor it yourself to keep it running…

I also upgraded to PHP 5.4 this week to see if that will make it more stable. Not holding my breath though.