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
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.
-