Nginx + php-fpm "504 Gateway Time-out" error with almost zero load (on a test-server)

minaev nginx-forum at
Wed Sep 8 13:48:15 MSD 2010


I have the same problem and I think I, probably, know what's causing it.
The bad thing is that I got it trying to solve another one and I don't
know how to fix both :)

So, until today, my server sometimes issued 504 error. The error log
reported "upstream timed out (110: Connection timed out) while reading
response header from upstream" error. Trying to fix it, I played with
various PHP-FPM timeouts. So, I increased pm.max_children from 5 to 10
and set request_terminate_timeout to 30s. Immediately after these
changes had been  made, 504 error was gone, but now I receive 502 with
the same diagnostics as yours: "Connection reset by peer".

Do you have request_terminate_timeout defined in your php-fpm.conf?

Posted at Nginx Forum:,127854,128331#msg-128331

More information about the nginx mailing list