LimitRequestBody: Apache Limiting User Upload File Size

by on April 26, 2008 · 4 comments· LAST UPDATED October 4, 2012

in , ,

I'd like to put limits on user(s) who are uploading files. How do I restricts the total size of the HTTP request body sent from the client under Apache 2 Web server?

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
RequirementsApache 2.x
Estimated completion timeN/A

To restricts the total size of the HTTP request body sent from the client use LimitRequestBody Directive. You can add this directive using .htaccess file or httpd.conf file under virtual host or directory configuration options. You can set value (in bytes) from 0 (unlimited) to 2147483647 (2GB) that are allowed in a request body.

For example, limit /var/www/vhost/ to 100K, you might use the following directive (add to .htaccess or httpd.conf file):

<Directory "/var/www/vhost/">
    LimitRequestBody 102400

Save and close the file. You need to restart or reload the httpd server as follows:
# service httpd restart
# service httpd reload

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 4 comments… read them below or add one }

1 Firas Alfraih April 28, 2008 at 9:28 am

how can I restrict abuse the internet (heavy download) on my linux firewall


2 teo November 21, 2011 at 7:12 am

The example is a bit misleading, since most probably files being uploaded to the /wp-uploads directory will be uploaded via a request to a script which is in another folder (usually its parent).


3 Hosting en Chile July 10, 2012 at 3:57 pm

Thanks you, Greetings from Chile


4 Paul October 4, 2012 at 10:00 pm

It’s old, but it’s a high ranking on Google, so I’m going to correct slightly here: you don’t need to do an httpd restart. Do a reload – it saves resources and keeps everything online.


Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: