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
Avatar Julian Bonpland Mignaquy
Updated 5 months ago
Applicable to: Plesk for Linux
Symptoms
Website example.com is not accessible. The following error is shown in a browser:
504 Gateway Time-out
The following error message appears in the domain error log file at Domains > example.com > Logs:
[proxy_fcgi:error] [pid 42290:tid 140458047010560] (70007)The timeout specified has expired: [client 203.0.113.2:54693] AH01075: Error dispatching request to :, referer: http://example.com/gallery
In Plesk > Domains > example.com > PHP Settings it is shown that the website uses “FastCGI” or “FPM” PHP handler.
Cause
Execution PHP code of the website takes longer than the specified timeout.
Resolution
To fix the issue increase the timeout. FastCGI limits can be increased for an affected domain only or on a server-wide level. Both ways are described below.
Note: If after increasing the FastCGI limits the same error appears, try to increase the value of the limits to 1200 seconds. If it does not help, review and optimize the website code.
Note: In case it is necessary to run only one script with the increased timeout, consider running it in a scheduled task: How to schedule a task in Plesk for Linux?
Increasing the FastCGI limits for a single domain
Log into Plesk
In Plesk, go to Domains > example.com > Apache & nginx Settings.
Add the following lines to the text boxes Additional directives for HTTP and Additional directives for HTTPS:
FcgidIdleTimeout 600
FcgidProcessLifeTime 600
FcgidConnectTimeout 600
FcgidIOTimeout 600
Note: If the website still shows “504 Gateway Timeout” try increasing timeouts to higher values.
Example:
If FPM PHP handler is used, append additional two lines to the Additional directives for HTTP/Additional directives for HTTPS text boxes. The resulting set of Apache directives will be the following:
FcgidIdleTimeout 600
FcgidProcessLifeTime 600
FcgidConnectTimeout 600
FcgidIOTimeout 600
Timeout 600
ProxyTimeout 600
Click OK button to apply the changes
Increasing the FastCGI limits server-wide
Connect to the Plesk server via SSH as root user.
Open the FastCGI configuration file fcgid.conf in a text editor. Use the guide for “vi” editor, if required. Location of the file depend on operating system:
for CentOS/RHEL/CloudLinux distributions:
/etc/httpd/conf.d/fcgid.conf
for Debian/Ubuntu distributions:
/etc/apache2/mods-enabled/fcgid.conf
Increase FastCGI timeout limits as shown below:
FcgidIdleTimeout 600
FcgidProcessLifeTime 600
FcgidConnectTimeout 600
FcgidIOTimeout 600
If FPM PHP handler is used create /etc/httpd/conf.modules.d/00-proxy_timeout.conf then add the following lines into it:
Timeout 600
ProxyTimeout 600
Test configuration with “apachectl configtest” command, and it should return the following:
apachectl configtest
Syntax OK
Restart Apache:
for CentOS/RHEL-based operating systems:
service httpd restart
for Debian/Ubuntu-based operating systems:
service apache2 restart