Alot of people ask me how I can host clients as large as a certain few that I do efficiently. This quick tutorial explains how to limit bandwidth consumption on files over ___ kb/mb in order to keep overall kb/s or mb/s bandwidth usage to a minimum in order to maintain high download speeds for webpages, but slow down connections for large files and/or file farms (download sites).
There are two different choices for accomplishing this task, I currently utilize both Apache modules but for different reasons, one allows you to specify specific file types (.wav, .mp3, .avi, etc.) and one limits overall usage by each virtualhost.
In order to limit specific file types, i’d recommend the mod_bandwidth port for Apache 2, called bw_mod which is avaliable at http://www.ivn.cl/apache/
This module is relatively easy to get up and running and configured on an Interworx server as the process is the same for any version of Apache
Step One:
Download the latest version from the website mentioned above.
Step Two:
Extract the tarball by executing tar -zxf bw_mod-0.6.tgz
Open the folder of the bw_mod files.
Step Three:
/usr/sbin/apxs -i -a -c bw_mod-0.6.c (change the version respectively)
Step Four:
Restart Apache
Step Five:
Edit the respective virtualhost files in /etc/httpd/conf.d to include the options you want, in my case the following configuration is used in order to limit files over 500kb to be downloaded at roughly 30kb/s:
BandWidthModule On
LargeFileLimit * 500 30240
Step Six:
Restart Apache
Step Seven:
Enjoy faster page loads, while efficiently allowing users to run their sites with large downloadable files.
…The second solution is called mod_cband which is avaliable at http://cband.linux.pl, the install process is almost the exact as the one mentioned above, but always check the documentation avaliable on their site, it has a lot more functionality but doesn’t include limiting by file type.
Hope this has been a helpful tutorial and helps you maintain efficient Interworx servers