phpnginxtimeoutwhm

504 upstream timeout - nginx


we are working on shopware 5 and it is running on php 7.3. Also, it uses php-fpm.

PHP-FPM config

request_terminate_timeout = 300s

NGINX config

# Timeout settings for Nginx
client_body_timeout 1800s;    # Time in seconds (30 minutes)
client_header_timeout 1800s;  # Time in seconds (30 minutes)
keepalive_timeout 3600s;      # Keep-alive timeout (optional, 1 hour)
send_timeout 1800s;           # Time to wait for a response (30 minutes)

# If using proxy
proxy_read_timeout 1800s;     # Allow for longer responses (30 minutes)
proxy_send_timeout 1800s;     # Allow for longer sends (30 minutes)


fastcgi_read_timeout 1800s;
fastcgi_send_timeout 1800s;

PHP config

max_execution_time 1800s
memory_limit -1

nothing is overriden by .htaccess file.

ISSUE: any script that take time more then 5 minutes is getting canceled with following error.

[error] 105907#105907: 14762 upstream timed out (110: Connection timed out) while reading response header from upstream, client: ..., server: my-domain.com, request: "GET /api/subPath HTTP/1.1", upstream: "https://...:444/api/subPath", host: "my-domain.com"

CONTEXT: we are using WHM server. And we tried almost all the possible config options.

QUERY: Anybody have idea how to increase upstream timeout? In short PHP scripts should not be killed after 5 minute.


Solution

  • Finally I got the solution. I executed nginx -T. It shows me the loaded configuration. using this, I came to know about the file which was actully overriding all the custom configuration. So, I added my custom config in it.

    proxy_read_timeout 1800s
    fastcgi_read_timeout 1800s