Symptoms
After Apache is updated to version 2.4.54, file uploads larger than 1 GB fail with the following error:
CONFIG_TEXT: Requested content-length of 1128468864 is larger than the configured
limit of 1073741824
This error is also known as "Request Entity Too Large" on many websites.
When using Mod_LSAPI for CloudLinux, it will show the following error:
CONFIG_TEXT: [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,
Cause
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 the log files may show that the content length exceeds the configured limit. You can find more details on the Apache documentation pages.
Apache core configuration - LimitRequestBody
Resolution
Edit the website .htaccess file. Alternatively, you can configure this in Apache via include files to apply it to all websites and increase the default limit.
Edit the website .htaccess file to set the option LimitRequestBody.
- Navigate to the public_html directory in either the cPanel File Manager or SSH/CLI/FTP
- Open the .htaccess file
-
Add syntax:
CONFIG_TEXT: LimitRequestBody 2073741824
- Save the file and exit
- Log in to WHM as root
- Navigate to the "WHM / Apache Configuration / Include Editor"
- Select the include file
Pre VirtualHost Include -
Add the following syntax:
Note: This will double the default value.CONFIG_TEXT: LimitRequestBody 2073741824
- Save and restart Apache
-
In SSH/CLI/Terminal, edit the file
/etc/apache2/conf.d/includes/pre_virtualhost_global.conf.Setting the value,
LimitRequestBodyfor example, to the below will double the default value.CONFIG_TEXT: LimitRequestBody 2073741824
-
Test the configuration to confirm the Syntax is "OK".
# apachectl configtest
Note: It should return "Syntax OK", if not something needs to be corrected in the syntax.
-
Restart Apache if the 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.
Comments
0 comments
Article is closed for comments.