3

Our nginx refuses to increase the timeout for a request from the default of 60 seconds.

I've already set the following parameters, but the server still gives me 504 after 60 seconds:

fastcgi_connect_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
client_header_timeout 300s;
client_max_body_size 200m;
client_body_timeout 300s;
send_timeout 300s;

Interestingly enough, setting the values to 30 seconds works and the request times out after 30 seconds. The request_terminate_timeout in php-fpm is also set to 300 seconds.

Which parameters do I have to set to get it further than 60 seconds?

  • If it's just a script which takes longer to execute, increasing fastcgi_read_timeout should be all that is needed. The other timeouts shouldn't apply in my opinion. – Oliver Jul 3 '15 at 9:59
  • nginx.org/r/fastcgi_connect_timeout "It should be noted that this timeout cannot usually exceed 75 seconds". Why you applications doesn't accept connection for so long? Perhaps you should fix that. – Alexey Ten Jul 3 '15 at 10:25
  • I suggest your application architecture needs to change - no web request should take more than a few seconds. – AD7six Jul 3 '15 at 18:23
  • is your php.ini overrides these settings? – ADM Jul 4 '15 at 9:06
6

So, if somebody else has that problem and can't find an answer, here is my fix, after 2 more hours of searching.

The culprit was our Amazon Load-balancer. The servers run on ec2-instances, which are behind a load-balancer. The load-balancer has an idle-timeout of 60 seconds set. Just setting this timeout to the desired value described here removed the 504.

| improve this answer | |
  • I didn't even realize they had a timeout here. I thought I was going crazy. Thanks for posting what you found! – James Feb 15 '19 at 15:54

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.