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
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: 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
-
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 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200
Timeout 1200
ProxyTimeout 1200Note: If the website still shows "504 Gateway Timeout" try increasing timeouts to higher values.
-
Click OK button to apply the changes.
Increasing the FastCGI limits server-wide
-
Open the FastCGI configuration file fcgid.conf in a text editor with a text editor such as "vi" or "nano". 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 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200 -
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
-