1

My 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?

2
  • Did you also set max_execution_time in php.ini? If not, try that (don't forget to restart php-fpm after modifying php.ini) Commented Sep 7, 2020 at 9:21
  • i already set max_execution_time in php.ini to 300 and request_terminate_timeout to 300 in www.conf and i'm still getting 504 gateway timeout error Commented Sep 7, 2020 at 9:40

1 Answer 1

7

Have you added the following directives at the end of the 'http' section?

http {
    <...>
    include /etc/nginx/conf.d/.conf;

    proxy_send_timeout 180s;
    proxy_read_timeout 180s;
    fastcgi_send_timeout 180s;
    fastcgi_read_timeout 180s;
}

You may also need to restart your nginx server after this.

Another possible cause to why nothing changes for you is that you might edit the wrong file, but that I doubt. :)

To verify the path, both nginx -t and nginx -V would print out the default nginx config file path.

Source: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout

Sign up to request clarification or add additional context in comments.

7 Comments

yes i already did it but i have problem with that directory. there's no file inside conf.d Pic1 Pic2
@MagnusEriksson oops, idk why I wrote fpm.
@fuher If you try to use nginx -t to verify your config path, you might find it
i checked the path and it's saying "--conf-path=/etc/nginx/nginx.conf"
@Fuher what happends if you set request_terminate_timeout=300s in the php-fpm config? Usually located in /etc/php5/fpm/php-fpm.conf
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.