Hi,
I have an Ubuntu 9.10 server on AMAZON EC2 running Nginx +PHP with PHP FASTCGI via port 9000.
The server runs fine for a few minutes and after a few minutes (several thousands of hits in this case) FastCGI dies and Nginx returns 502 Error.
Nginx log shows 2010/01/12 16:49:24 1093#0: *9965 connect() failed (111: Connection refused) while connecting to upstream, client: 79.180.27.241, server: localhost, request: “GET /data.php?data=7781 HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “site1.mysite.com”, referrer: “http://www.othersite.com/subc.asp?t=10”
I’ve experiencing something similar.
After some time (some hours, but I’m getting not that much hits), PHP
appears to be not responding anymore:
Processes are running, but nginx times out:
First with
upstream timed out (110: Connection timed out) while reading
response header from upstream
then
recv() failed (104: Connection reset by peer) while reading response
header from upstream
This happened with php-cgi and a custom start script a few days ago
(same symptoms, have not checked logs carefully), and today after I’ve
switched to using php-fpm.
So, both php-cgi and php-fpm appear to not behave well with nginx.
Those problems never appeared using lighttpd (in the same
container/machine), but are happening now since I have only PHP
running in the container/machine and nginx (acting as first proxy in
line) is directly forwarding to it.
Maybe this did not happen with lighttpd before, because it (and the
php-cgi process) was regularly restarted, which is not the case
currently.
I’ve found PHP :: Bug #39809 :: FastCGI Requests silently dropped
I’m running PHP 5.3.1-0.dotdeb.1 and nginx 0.8.33-0~ppa2.
I guess this is rather a PHP than an nginx problem, since restarting
php-fpm fixes it.
For now, I’ve tried bumping the number of child processes, hoping that
this will prevent the PHP processes entering the ignoring state.
Here’s a munin graph from the PHP container
(http://i.imgur.com/MHbNi.png) - the failing started with the
increasing number of established network connection: those are
probably the connections from nginx queuing up, without being
answered.
How can I debug what is causing FastCGI to die ?
So in your case there aren’t any php-cgi processes anymore? Have you
checked the php error log?
Cheers,
Daniel
–
http://daniel.hahler.de/