php-fastcgi always exits.. resulting in 502 bad gateway

António P. P. Almeida appa at perusio.net
Thu Sep 22 12:32:17 UTC 2011


On 22 Set 2011 11h44 WEST, nginx-forum at nginx.us wrote:

> Hello everyone,
>
> I'm using nginx since some days and I got a little trouble. It seems
> that after some while of working fine nginx exits the fastcgi-daemon
> and whenever I try to call a php site then, it shows me 502 Bad
> Gateway.
>
> Then I have to "/usr/bin/php-fastcgi start" and everything runs fine
> again.

> So basically my question: How do I make the php-fastcgi not exit
> itself or how do I make it automatically restart on exit? It's
> annoying that my website everytime turns to "502 Bad Gateway" to
> everyone and I don't even know about that!
>
> Can anyone help me please? :(

Use one of the many init scripts available throughout the
interwebs. Also I suggest monit for monitoring the process. 

I now use php-fpm, but before I used the "regular" php-cgi with this
init script: https://github.com/perusio/php-fastcgi-debian-script and
a monit configuration for monitoring it:
https://github.com/perusio/monit-miscellaneous/blob/master/php-cgi

HTH,
--- appa



More information about the nginx mailing list