I have a test server with nginx and php-fpm.

Pages on the site are opening correctly, but when I want send POST request for example an "authorize on site" I get "504 Gateway Time-out error". Nginx and php-fpm are configured with default settings.

What could be the reason for the 504 ?

  • The best way to tackle this problem is to look into nginx-error.log.
    – alexus
    Nov 18, 2014 at 16:20
  • Did you resolve this? I am having the same issue. Aug 21, 2015 at 17:24

2 Answers 2


That seems to be a pretty common problem, as shown on the past at StackOverflow:

Anyway, for your specific problem I'd say the answer lies in the PHP-FPM configuration. Maybe you should check your php-fpm.conf (if you've got PHP5-FPM, you should check /etc/php5/fpm/pool.d/www.conf or /etc/php5/fpm/php-fpm.conf) and set this parameter:

request_terminate_timeout = 30s

Changing that to lower or higher value could be useful too if things don't work.


You can also handle this on the nginx side if nginx is timing out when you are doing your fastcgi pass by using these directives in the stanza with the fastcgi_pass:

fastcgi_connect_timeout 60;
fastcgi_read_timeout 60;

Those would set the connect and response timeout to 60 seconds before nginx would give you the 504.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.