fastcgi_keep_conn + PHP-FPM

Steffen Weber at
Wed Feb 6 10:00:42 UTC 2013

The changelog of nginx 1.3.12 mentions a bugfix in the "fastcgi_keep_conn"
directive. Therefore I decided to give this feature a try.

Snippet from nginx.conf:

        fastcgi_keep_conn on;

        upstream php {
                keepalive 6;

Snippet from php-fpm.conf:

        listen =
        pm = static
        pm.max_children = 4
        pm.max_requests = 5 # very low for demo purpose

Now I run the following command:

while true; do wget http://localhost/test.php -O- > /dev/null; done

After 5 requests (pm.max_requests = 5) wget hangs and nginx logs the
following error:

2013/02/06 10:47:09 [error] 6795#0: *6 readv() failed (104: Connection
reset by peer) while reading upstream, client: ::ffff:, server:
localhost, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://", host: "localhost"

It seems that nginx cannot cope with a restarting php-fpm process. Anything
I can do?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list