Nginx + php-fpm "504 Gateway Time-out" error with almost zero load (on a test-server)
I found answer on my posting on the nginx forum - http://forum.nginx.org/read.php?2,127854
The answer, in my case, is to set:
request_terminate_timeout=30s
in php-fpm config (usually /etc/php5/fpm/php-fpm.conf
)
Note, you can use values other than 30s also.
I used it to match my value in main php.ini
file which is:
max_execution_time = 30
Thanks All. :-)
Here how it resolved my issue:
make following changes to /etc/nginx/nginx.conf in http { section
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
and then restart nginx
/etc/init.d/nginx restart
If you are using php 5.3, increase the backlog.
If you are using php 5.2, backport the patch to increase the backlog size from 128.
Also, use a unix socket rather than a TCP socket. unix:/tmp/php5-cgi.sock (or the relevant path)