Timeout Issue (Apache+Nginx+PHPFPM)

Hi,
I’m having a timeout issue with only one of the subdomains but other websites work fine.

The phpfpm service restarts randomly and after that, the timeout issue starts.

I’m using Cloudflare for DNS.

The apache2 log has the following entry:

[Sun Jun 21 17:05:25.532577 2020] [proxy_fcgi:error] [pid 27501] (70007)The timeout specified has expired: [client 150.XXX.XXX.XXX:38972] AH01075: Error dispatching request to : (polling), referer: https://api.mysite.com/

Hestia Version: v1.1.1

OS: Ubuntu 18.04

Install String:

bash hst-install.sh --apache yes --nginx yes --phpfpm yes --multiphp no --mysql yes --postgresql no --vsftpd yes --proftpd no --named yes --exim yes --dovecot yes --clamav no --spamassassin no --iptables yes --fail2ban yes --quota no --api yes --lang en --port 8083 --interactive yes

Domain Configuration

  1. mysite.com: Blank
  2. api.mysite.com: root index.php → Blank, v1 directory has all the files
  3. XX-cc-cloud.mysite.com → Hostname
  4. XX-cc-app.mysite.com → proxy pass to localhost

^XX = random numbers
^^cc = country codes

nginx.ssl.conf for XX-cc-app.mysite.com

Summary
server {
    listen      XX.XXX.XX.XX:443 ssl http2;
    server_name XX-cc-app.mysite.com;
    ssl_certificate      /home/admin/conf/web/XX-cc-app.mysite.com/ssl/XX-cc-app.mysite.com.pem;
    ssl_certificate_key  /home/admin/conf/web/XX-cc-app.mysite.com/ssl/XX-cc-app.mysite.com.key;
    ssl_stapling on;
    ssl_stapling_verify on;
    error_log  /var/log/apache2/domains/XX-cc-app.mysite.com.error.log error;

    include /home/admin/conf/web/XX-cc-app.mysite.com/nginx.hsts.conf*;

    location ~ ^/v1 {
        return 444;
    }
    
    location / {
        proxy_set_header X-Real-Ip 127.0.0.1;
        proxy_set_header X-Forwarded-For 127.0.0.1;
        proxy_set_header Host $host;
        proxy_set_header REMOTE_ADDR 127.0.0.1;
        proxy_pass      https://127.0.0.1:6775;
    }
    
    location /error/ {
        alias   /home/admin/web/XX-cc-app.mysite.com/document_errors/;
    }

    location ~ /\.ht    {return 404;}
    location ~ /\.svn/  {return 404;}
    location ~ /\.git/  {return 404;}
    location ~ /\.hg/   {return 404;}
    location ~ /\.bzr/  {return 404;}

    include /home/admin/conf/web/XX-cc-app.mysite.com/nginx.ssl.conf_*;
}

^REMOTE_ADDR is set to 127.0.0.1 due to third party application limitations.

See php - Apache proxfy_fcgi - Error dispatching request to - Stack Overflow

Also check the error reporting of your php code.

1 Like

Also found the same reference on plesk, so probaly there is something wrong with your code or it just needs more execution time: https://support.plesk.com/hc/en-us/articles/115000064929-Website-on-Plesk-server-is-not-accessible-504-Gateway-Time-out-The-timeout-specified-has-expired-client-203-0-113-2-54693-AH01075-Error-dispatching-request-to

Thanks for the reply, but it times out even on the empty PHP files until I restart the PHP-FPM service.

check phpinfo() if “session.auto_start” is set to true

1 Like

Hi @Lupu,
It’s set to “Off”, can you guide me on where I can check why PHP-FPM restarts and then the website starts to timeout?