Applicable to:
- Plesk for Linux
Symptoms
-
Uploading large files through PHP apps to a Plesk domain fails:
500 Internal Server Error
,502 Bad Gateway
-
The domain's Apache error log shows this message if nginx support is enabled:
mod_fcgid: HTTP request length ... (so far) exceeds MaxRequestLen (1310720)
-
The domain's nginx error log shows this message:
upstream prematurely closed connection while reading response header from upstream
Cause
The Apache parameters FcgidMaxRequestLen and FcgidMaxRequestInMem have too low of a value for the file's size.
Resolution
-
Log in to Plesk
-
Go to Domains > example.com > Apache & Nginx settings
-
Add these lines to Additional directives for HTTP & HTTPS:
<IfModule mod_fcgid.c>
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100
FcgidProcessLifeTime 7200
FcgidIOTimeout 7200
FcgidMaxRequestInMem 1073741824
</IfModule>
The following solution only works with FPM application served by Apache. For other handlers, use custom templates.
-
Connect to the server over SSH
Note: Contact the server administrator if there's no SSH access
-
Edit
fcgid.conf
:- RHEL-based OS:
/etc/httpd/conf.d/fcgid.conf
- Debian based OS:
/etc/apache2/mods-available/fcgid.conf
- RHEL-based OS:
-
Set the same value for
FcgidMaxRequestLen
andFcgidMaxRequestInMem
in bytes. For example, 1073741824 for 1G. -
Restart Apache:
Warning: Websites will be down for a short time while restarting Apache
For RHEL-based OS
# service httpd restart || service apache2 restart
Comments
0 comments
Please sign in to leave a comment.