Site failed to open: 504 nginx error

Created:

2017-05-30 17:26:46 UTC

Modified:

2017-08-16 16:16:30 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Site failed to open: 504 nginx error

Applicable to:

  • Plesk for Linux

Symptoms

  • Site is showing 504 Gateway Timeout error

  • There are the following records in /var/www/vhosts/example.com/logs/error_log :

    [proxy_fcgi:error] [pid 22478:tid 140642738964224] (70007)The timeout specified has expired: [client 203.0.113.2:55010] AH01075: Error dispatching request to : 
    
  • There are the following records in /var/www/vhosts/example.com/logs/proxy_error_log :

    [error] 16723#0: *1 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: "http://198.51.100.2:7080/", host: "example.com" 
    
  • There are the following records in domain's php-fpm log ( /var/log/phpX-fpm.log or /var/log/plesk-phpXX-fpm/error.log , where X is a PHP version)

    WARNING: [pool example.com] child 6041 said into stderr: "NOTICE: PHP message: PHP Warning: getimagesize(http://example.com/some_path/picture.JPG): failed to open stream: Connection timed out in /var/www/vhosts/example.com/httpdocs/some_path/script.php on line 61"
    
  • Site opening via curl from the server shows that IPv6 is used:

    # curl -vvv -I http://example.com/
    * About to connect() to example.com port 80 (#0)
    * Trying 2001:db8:f61:a1ff:0:0:0:80...
    * Connection timed out
    * Trying 2001:db8:f61:a1ff:0:0:0:80...

Cause

DNS servers misconfiguration

Resolution

As a workaround temporarily add the following record in the /etc/hosts file:

    203.0.113.2 example.com www.example.com

In general, configure DNS servers on the server.

Have more questions? Submit a request
Please sign in to leave a comment.