Apache 413 Request Entity Too Large

On a CentOS server, when uploading a 100 MB video file in WordPress media manager, I got the following error message

Request Entity Too Large
The requested resource /wp-admin/async-upload.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

The server had mod_security installed. I edited the mod_security config file

vi /etc/httpd/conf.d/mod_security.conf

Set following for values and restart Apache.

SecRequestBodyLimit 1073741824000
SecRequestBodyNoFilesLimit 1073741824000
SecRequestBodyInMemoryLimit 1073741824000

But I still get the same error. So I disabled mod_security by moving the config file to a temporary directory and restarting apache.

The error was due to Apache setting LimitRequestBody, the error is fixed by adding “LimitRequestBody 0” in the .htaccess file used by WordPress.

LimitRequestBody 0

Now when I enable mod_security, I get 500 error, I disabled mod_seurity for the file upload PHP script used by WordPress by editing the Apache VirtualHost entry of the website and adding


    SecRuleEngine Off

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *