Applicable to:
- Plesk for Linux
Symptoms
-
Unable to upload a file using a web application or webmail, the following error is shown:
An error occurred!
File upload failed -
On uploading a big file via WordPress administrator interface, the following error is shown:
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
-
The following error can be seen in the browser's console:
413 Request Entity Too Large
-
Uploading of big size file fails with the following error in
/var/www/vhosts/system/example.com/logs/proxy_error_log
or/var/log/nginx/error.log
file:client intended to send too large body: 163625628 bytes, client: 203.0.113.2, server: example.com, request: "POST /attachments/uploading.json?hash=bb192e03d44f11110881f1c148ef629&content_type=resource_version&key=resource HTTP/1.1", host: "203.0.113.2", referrer: "https://203.0.113.2/resources/add?resource_category_id=13"
Cause
Webserver limits maximum filesize to be uploaded.
Resolution
Note: The following solution increases the limit server wide.
-
Adjust the following settings of PHP handler assigned to the domain in Tools & Settings > PHP Settings > X.X.XX FPM application in php.ini tab:
post_max_size 2000m
upload_max_filesize 2000m -
Perform the following steps depending on the webserver serving PHP in Domains > example.com > PHP Settings:
For case PHP is served by nginx-
Connect to the server via SSH.
-
Add the following directives to
/usr/local/psa/admin/conf/panel.ini
file using 'vi' utility to customize Plesk defaults:[webserver]
nginxClientMaxBodySize = 2000mNote: If file
/usr/local/psa/admin/conf/panel.ini
does not exist, create it from the sample file with this command:# cp /usr/local/psa/admin/conf/panel.ini.sample /usr/local/psa/admin/conf/panel.ini
-
Rebuild web server configuration files:
# plesk repair web -domains-only
-
Reload nginx:
# service nginx reload
For case PHP is served by Apache-
Connect to the server via SSH.
-
Backup the main Apache configuration file:
-
On RedHat/CentOS/CloudLinux operating systems:
# cp /etc/httpd/conf/httpd.conf{,.orig}
-
On Debian/Ubuntu operating systems:
# cp /etc/apache2/apache2.conf{,.orig}
-
-
Open the file from step 1. and add or modify the parameter
LimitRequestBody
to the required value in bytes, for example:LimitRequestBody 2147483647
Note: The maximum value of the parameter LimitRequestBody is 2147483647 (2 gigabytes).
-
Go to Domains > example.com > Hosting & DNS > Apache & nginx Settings and set Maximum allowed HTTP request body size to desired value, e.g. 2GB.
-
Click OK/Apply.
-
Comments
0 comments
Please sign in to leave a comment.