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?
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>
Save and close the file. You need to restart or reload the httpd server as follows:
# service httpd restart
OR
# service httpd reload
References:
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 4 comments… read them below or add one }
how can I restrict abuse the internet (heavy download) on my linux firewall
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).
Thanks you, Greetings from Chile
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.