Limit the upload bandwidth of your apache webserver with mod_bw
I've a server at home on a ADSL connection which has 100kBytes/s of upload and 1.2MBytes/s of download as bandwidth.
If someone download at full speed some large file on my web server, my internet connection become unusable.
To avoid this, I start to ask my friends to use a download manager to limit their download speed... but it's somewhat far too tricky for a lot of them...
So I use mod_bw developed by Ivan Barrera http://www.ivn.cl/apache/ (sourceforge : http://bwmod.sourceforge.net/).
Here is a quick way to limit the bandwidth used by Apache :
Install & enable (on Ubuntu):
sudo apt-get install libapache2-mod-bw
sudo a2enmod bw
Configure (your apache virtualhost conf file like /etc/apache2/sites-available/default) :
#... other config stuf for the virtual host
BandWidth 192.168.0.0/24 0
BandWidth all 80000
- line 1 : Activate the mod for the virtualhost.
- line 2 : Set a directive so that the mod limit the bandwidth on all http request. (you can use an alternate config to limit only some mime type)
- line 3 : set no limit for computer on your local area network.
- line 4 : set a limit to 80KB/s to all other computer
Restart Apache so that the config is loaded and test :
service apache2 restart (or apachectl restart)
Test with Firefox on a large file. From my computer, I've first commented with a heading # the third line (BandWidth 192.168.0.0/24 0) and when it works, I uncommented it.