Applicable to:
- Plesk for Linux
Symptoms
-
Unable to upload a file using an 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-
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).
-
Reload Apache configuration to apply changes:
-
On RedHat/CentOS/CloudLinux operating systems:
# service httpd reload
-
On Ubuntu/Debian operating systems:
# service apache2 reload
-
-
Comments
10 comments
In Plesk Obsidian 18.0.29, the default value for nginxClientMaxBodySize is :
as stated by the "panel.ini editor" extension.
Hello Francesc Benavent
You're right, I will adjust the article.
Didn't help. Still the same issue.
same here. Still the same issue :( Any ideas? - Plesk Obsidian Version 18.0.36
I have probably found the problem. If one carries under "/var/www/vhosts/system/meinedomain.de/conf/nginx.conf" at location / also again client_max_body_size 500M; and restart nginx, it works. Can this (location area) be set via the Plesk web interface?
After setting new value in panel.ini, one should execute
# plesk sbin httpdmng --reconfigure-all
or
# plesk repair web -domains-only
instead of
# plesk repair web -server
actually, isn't it?
Hello Andy Herzig,
Thank you for pointing us to that issue in the article.
It is now updated with the correct information.
Hello,
i have a nearly "same" problem.. dont know how to define else ;)
A Friend of mine in Bangladesh only can upload files smaller than 2mb. Its not depending on User, because he also testet with my admin account. But i can upload everything wit mine and also with his user.
i changed execute time, max filesize and all this parameters.. but the filemaneger upload dont gave us any error. he tryd and found out that only smaller than 2mb files work.
i think its maybe an hidden parameter which overrules the plesk system, because i think in plesk everything is ok now.
maybe someone has any idea? thanks guys!
Hi, currently i have the problem that i cant upload an mp4 which is 200MB in size... This problem appears in WordPress. I tested this on 2 different servers with 2 different installations. A file with 100MB works just fine...
I have to ask, is this a bug in Plesk? I dont understand why i have to modify configuration files by hand when those settings are clearly available in Plesk.
However after doing this with one server the problem is not solved. Even after server restart and checking the configuration files manually i still get the error from WordPress:
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
Uploading files is a very basic function that should work out of the box... What can i do to fix this? It somehow seems that the limit of 128m is hardcoded somehow or i missed a place... I also checked the nginx.conf under the vhost and the correct values are applied...
https://gyazo.com/1c41b3f163bb6d005db0ff270471e724
Kind regards
Patrick
Understood, but the problem is a bug with Nginx and or the relationship with the stack as a proxy. Absent Nginx as an antecedent and relying on Apache without the proxy relationship now works fine. So it may be the unique relationship with Nginx as a proxy to apache, in the stack. I've done this absent Plesk just fine.
Disable Nginx as a proxy to Apache in system tools. -
Please sign in to leave a comment.