Send 502 when all php-fpm workers are in use

justink101 nginx-forum at
Sun Jul 6 02:47:43 UTC 2014

I have a php-fpm pool of workers which is 6. There are long running requests
being sent, so I have the following fastcgi directives set:

fastcgi_connect_timeout 15;
fastcgi_send_timeout 1200;
fastcgi_read_timeout 1200;

However right now, if the php-fpm pool of workers is full, a request waits
the full 20 minutes. I'd like requests to fail with a 502 status code if the
php-fpm pool of workers is full instead. This change should still allow long
running requests (max 20 minutes) though. I would have thought if the
php-fpm pool workers are all being used, a request would timeout in 15
seconds according to fastcgi_connect_timeout, but this does not seem to be
the case.

Thanks for the help.

Posted at Nginx Forum:,251476,251476#msg-251476

More information about the nginx mailing list