Symptoms
-
When using PHP as FastCGI, if you try to upload a large file, the below error occurs and causes
or
550 internal server error
502 Bad Gateway. -
If nginx support is enabled, ApacheÂ
/var/www/vhosts/system/example.com/logs/error_log
contains the following error:mod_fcgid: HTTP request length ... (so far) exceeds MaxRequestLen (1310720)
-
Nginx
/var/www/vhosts/system/example.com/logs/proxy_error_log
contains the error below:upstream prematurely closed connection while reading response header from upstream
Cause
The
 and/orÂ
FcgidMaxRequestLenFcgidMaxRequestInMem
directives are not large enough.
Resolution
Click on a section to expand
Server-wide
- Connect to the server via SSH.
Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.
- Edit
file which is located in
fcgid.conf/etc/httpd/conf.d/
(for RHEL based OS) or/etc/apache2/mods-available/
(for Debian based OS). -
Set
and
FcgidMaxRequestLen
with the same values in bytes. For example, 1024 MB corresponds to 1073741824 B.
FcgidMaxRequestInMem
-
Restart Apache:
For RHEL based OS
# service httpd restart
For Debian based OS:
# service apache2 restart
Click on a section to expand
On domain level
-
Log into Plesk
-
Go to Domains > example.com > Apache & Nginx settings > Additional directives for HTTP & HTTPS
<IfModule mod_fcgid.c>
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100
FcgidProcessLifeTime 7200
FcgidIOTimeout 7200
FcgidMaxRequestInMem 1073741824
</IfModule>