fastcgi causing 502 errors? [was: alternating 404 and 200]

Jeffrey 'jf' Lim at
Thu Sep 3 23:48:43 MSD 2009

2009/9/4 Nuno Magalhães <nunomagalhaes at>

> I'm running nginx/0.8.10 and PHP 5.2.10 on Debian Sid with a
> 2.6.30-1-amd64 kernel. This is my desktop machine, mainly for testing
> and screwing around with configurations (although screwing up also
> comes to mind). I've recently upgraded my system through Debian's
> apt-get dist-upgrade, which reset my fastcgi_params.
> Nginx spawns two worker processes, php-fastcgi spawns 4, nginx is the
> only http server i'm running, i have no proxies or anything.
> If i have an URL like http://localhost:8080/site01/file.php?var=param
> and hit the reload button constantly, i'll get a bunch of normal
> replies (200), followed by a bunch of 502s, then 200, then 502, ...
> The interval is about the same, maybe a second or so.
> If i use http://localhost:8080/simplefile.html for a simple lorem
> ipsum html file i sometimes get the 502 in the first few reloads, but
> after that it's just 200.

how heavy is your '/site01/file.php' script? (btw, I dont see any reference
to it in your 502 log file)

I would imagine that the cause would be because nginx does not queue
connections. And you have only a limited number of fastcgi processes (or how
are u running your fastcgi?) Therefore when they are busy, and cannot accept
connections, you will get a reset (i dont know how u're setting up your
fastcgi, but!). The html without php gets cached very easily - therefore
it's 200s all the way after any initial problems.


In the meantime, here is your PSA:
"It's so hard to write a graphics driver that open-sourcing it would not
   -- Andrew Fear, Software Product Manager, NVIDIA Corporation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list