Issues with websites timing out, then working fine

Discussion in 'Server Operation' started by breakaway, Jan 17, 2020.

  1. breakaway

    breakaway Member

    Hi All,

    I've got a debian stretch box running ispconfig 3.1.13p1 - and all the websites hosted on this system are using cloudflare proxying.

    This system hosts a few low traffic sites. In the last few months, I've noticed an issue where if you don't access a website for a long time, then try to access it, cloudflare will give a timeout. But if you reload the page, everything works just fine, and continues to work fine for the rest of the "session".

    The error.log for the offending site says this:

    2020/01/17 14:22:39 [error] 29193#29193: *29966 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 108.162.250.93

    Its almost as though if the site isn't accessed for a while, it gets paged out, then serving it up for the first time takes too long so cloudflare calls it quits and gives the users an error message. But once you reload, it works fine (until such a time as the site hasn't been accessed for several hours/day(s) - then it starts again).

    This only affects to affect sites that use php (wordpress etc). We've got a few static sites (just html/css) - those seem fine. For now, I've setup a cron job to access the site every 5 minutes to keep it "live".

    Any ideas on how to fix this permanently?
     
  2. Steini86

    Steini86 Active Member

    Is this the whole error message? Usually, you get told what the upstream service is that timed out. I had something like that on my NAS, when something needed to be read from hard drive and they went to sleep.
    You could increase nginx timeout settings like
    Code:
    fastcgi_read_timeout 540;
    proxy_connect_timeout 3000s;
    proxy_send_timeout   3000;
    proxy_read_timeout   3000;
     
  3. Minhgun1231

    Minhgun1231 New Member

    thanks you
     
  4. breakaway

    breakaway Member

    Is this the correct way to increase a timeout using those directives? https://snipboard.io/Qnafws.jpg

    I just did that, and logging into word press again, here's what I got

    Code:
    # cat /var/www/website.com.com/log/error.log
    2020/02/14 00:39:23 [error] 8016#8016: *14 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 214.223.120.98, server: website.com.com, request: "POST /wp-login.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.0-fpm/web3.sock", host: "website.com.com", referrer: "https://website.com.com/wp-login.php?redirect_to=https%3A%2F%2Fwebsite.com.com%2Fwp-admin%2F&reauth=1"
     
  5. breakaway

    breakaway Member

    Bump, anyone has any ideas?
     
  6. Steini86

    Steini86 Active Member

    You can try these additional settings in php configuration:
    max_execution_time = 300

    If the site is low traffic, have you tried without cloudflare?
     

Share This Page