Nginx: 504 Gateway Time-out

Created:

2017-05-28 16:26:40 UTC

Modified:

2017-08-16 16:53:45 UTC

3

Was this article helpful?


Have more questions?

Submit a request

Nginx: 504 Gateway Time-out

Applicable to:

  • Plesk for Linux

Symptoms

  1. A website fails to load with the error:
    504 Gateway Time-out
  2. If PHP-FPM is used, the following is found in log file /var/www/vhosts/system/example.com/logs/proxy_error_log:
    [error] 1096#0: *25 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 203.0.113.2, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:///var/w
    ww/vhosts/system/example.com/php-fpm.sock", host: "example.com"

Cause

Insufficient timeout limits for nginx.

Resolution

For one domain:

Set the directives in Domains > example.com > Apache & nginx Settings > Additional nginx directives :

proxy_connect_timeout 1200s;
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
fastcgi_send_timeout 1200s;
fastcgi_read_timeout 1200s;

Globally:

  1. Create backup of nginx.conf:
    # cp /etc/nginx/nginx.conf nginx.conf_backup
  2. Increase values or add the directives mentioned above to Nginx configuration file /etc/nginx/nginx.conf :
  3. Restart Nginx service:
    # systemctl restart nginx
Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    iamkingsleyf

    now is 502 error, plesk have started again

  • 0
    Avatar
    Pavel Mikhaylov

    Hello iamkingsleyf,

    Do you experience the issue with 502 error at the moment?

    If you do, please let us know, what are other symptoms of the issue? What is in the subscription log files?

    I would also like to recommend contacting our support: https://www.plesk.com/contact-support

    Edited by Pavel Mikhaylov
Please sign in to leave a comment.