Symptoms
After Apache updates to version 2.4.54, larger than 1G file uploads fail with the below error.
Requested content-length of 1128468864 is larger than the configured
limit of 1073741824
This error can also be referred to as "Request Entity Too Large" on many websites.
When using Mod_LSAPI for CloudLinux it will show the following error:
[Fri Sep 16 13:22:16.553705 2022] [lsapi:error] [pid 678:tid 473404]
[client xx.xx.xx.xx:62422] mod_lsapi: [host domain.com]
[req POST /upload.php HTTP/1.1] ap_client_block failed: 413,
Description
In Apache 2.4.53 and older versions, the LimitRequestBody limit was set to unlimited. Apache changed this value in version 2.4.54. After updating to this version, users uploading large files may receive a 413 error code, or in the log files, it will show the content length is larger than the configured limit. You can more details can be found on the Apache documentation pages.
Apache core configuration - LimitRequestBody
Workaround
Edit the website .htaccess file to set option LimitRequestBody.
- Navigate to the public_html directory in either the cPanel File manager or SSH/CLI/FTP
- Open the .htaccess file
- Add syntax:
LimitRequestBody 2073741824
- Save the file and exit
Alternatively, you can apply this setting in Apache via include files to apply to all websites to increase the default limit.
- With a text editor in SSH/CLI open file "/etc/apache2/conf.d/includes/pre_virtualhost_global.conf" for editing. Setting the value of "LimitRequestBody" for example to the below will double the default value.
LimitRequestBody 2073741824
- Test the configuration to confirm the Syntax is "OK".
apachectl configtest
Syntax OK
- Restart Apache if syntax check passes with OK. If not, stop here and address the syntax issue.
/scripts/restartsrv_httpd
- Uploads should return to normal after the change.
The setting can also be applied in WHM via the Include Editor. I recommend using Pre Main Include or Pre VirtualHost Include. See the below details for more information.
Comments
0 comments
Article is closed for comments.