Skip to Content

Apache2 Bandwidth Limit

Download and install the Bandwidth Module from the links below or the attached file.

Unpack
tar -zxf mod_bw-0.8_0.tgz
cd mod_bw
sudo apxs2 -i -a -c mod_bw.c

Then add this to your apache2.conf
LoadModule bw_module mod_bw.so
and this to your VirtualHost / enabled site

BandwidthModule On
ForceBandWidthModule On
LargeFileLimit .mp3 1 15000

I did mine to limit the speed of MP3 downloads to reduce the total server connection speed, but you can limit everything if you're needing to.
Bandwidth all 10240
MinBandwidth all -1

Note - you must have apxs2 installed to make this work, installed with this:
sudo apt-get install apache2-threaded-dev

Found at either location, or attached here
http://www.ivn.cl/apache/
http://bwmod.sourceforge.net/