LimitRequestBody: Apache Limiting User Upload File Size

by Vivek Gite on April 26, 2008 · 2 comments

Q. I'd like to put limits on user file uploading size. How do I restricts the total size of the HTTP request body sent from the client under Apache 2 Web server?

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/cyberciti.biz/wp-uploads to 100K, you might use the following directive (add to .htaccess or httpd.conf file):

<Directory "/var/www/vhost/cyberciti.biz/wp-uploads">
    LimitRequestBody 102400
</Directory>

Restart httpd (if added to httpd.conf):
# service httpd restart

References:

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 2 comments… read them below or add one }

1 Firas Alfraih April 28, 2008

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

Reply

2 teo November 21, 2011

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).

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 15 + 10 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the simple math so we know that you are a human and not a script.




Previous post:

Next post: