Applicable to:
- Plesk for Linux
Symptoms
- A website or webmail page is not loading and
500 internal server error
or504 Gateway Time-out
error is shown after ~30-60 seconds. -
The following errors can be found in Domains > example.com > Logs:
CONFIG_TEXT: [warn] mod_fcgid: read data timeout in 45 seconds
[error] Premature end of script headers
[core:error] End of script output before headers -
The following error can be found in
/var/log/apache2/error.log
:CONFIG_TEXT: [warn] mod_fcgid: process XXX graceful kill fail, sending SIGKILL
Cause
The FcgidIOTimeout value - the maximum period of time the module will wait while trying to read from or write to a FastCGI application - has been exceeded.
Resolution
Increase the parameter value or optimize FastCGI application.
Domain-wide solution. FcgidIOTimeout
parameter for a domain is set to the same value as
max_execution_time
PHP parameter.
- Log into Plesk UI.
- Increase max_execution_time (e.g. to 300) in Domains > example.com > PHP settings
-
Add the following to Domains > example.com > Apache & Nginx settings > Additional directives for HTTP and Additional directives for HTTPS:
CONFIG_TEXT: <IfModule mod_fcgid.c>
FcgidIOTimeout 300
</IfModule> -
If it does not help, increase the parameter to higher value.
Optionally, switch the domain to FPM handler at Domains > example.com > PHP Settings.
Server-wide solution:
- Connect to the server using SSH.
- Open the
/etc/apache2/mods-enabled/fcgid.conf
file (on Debian/Ubuntu) or the/etc/httpd/conf.d/fcgid.conf
file (on RedHat/CentOS/CloudLinux), edit it with text editor and increase "FcgidIdleTimeout" and "FcgidProcessLifeTime" parameters to "300" or more:FcgidIdleTimeout 300
FcgidProcessLifeTime 300 -
Reload Apache service configuration:
On RedHat/CentOS/CloudLinux systems:
# service httpd reload
On Debian/Ubuntu systems:
# service apache2 reload
- If it does not help, increase the value of both parameters to higher values and reload Apache service configuration.
Comments
5 comments
Christian,
Glad to know the issue has been fixed!
Just for your reference, the same solution is described in this article.
Thanks a lot
In fact the problem was that I had too many connexions from users (my customers) using the webmail or at least postfix.
I hire a guy that found that I should modify /etc/courier-imap/imapd
He changed MAXDAEMONS to more that it was.
MAXDAEMONS=128
I hope that this can help anybody. Since that no more problems with error 500 or slow login in the webmail or anything slow using the webmail.
share
Hi @Christian!
Directives which are mentioned in the article, are designed for Apache web server, thus they can be added in following fields only:
Hello,
When I paste the code in Additional nginx directives the code is red and I think this is wrong. My webmail is still slow from time to time. What can I do ?
Can you help ?
Regards
Kris
Configuration :
Ubuntu 14.04.5 LTS
Plesk Onyx Version 17.8.11 Update #18
Please sign in to leave a comment.