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

Reinis Rozitis r at
Tue Sep 7 14:33:43 MSD 2010

> After debugging for 6-hours - I am giving this up :|

First of all since this is clearly a php-fpm issue you should have checked 
(enabled) the php-fpm logs.

In your php-fpm.conf there should be lines:

error_log = /some/path/error.log
log_level = notice

and for debugging / performance purposes its good to add:

request_terminate_timeout = 60s
request_slowlog_timeout = 20s
slowlog = /some/path/slow.log

This way php-fpm will start to log/backtrace (print the codeparts in 
logfile) of requests which take longer than 20 seconds (you can adjust by 
your own needs) and kill those taking longer that minute.

It should pretty much give you an idea what is happening and/or slowing down 
the php to level it hangs up (the typical case is usually some code 
involving sockets or db backends).


More information about the nginx mailing list