mod_cband is an Apache 2 module provided to solve the problem of limiting virtualhosts bandwidth usage. When the configured virtualhost’s transfer limit is exceeded, mod_cband will redirect all further requests to a location specified in the configuration file.
Shell> tar zxvf mod-cband-0.9.7.4.tgz
Shell> cd mod-cband-0.9.7.4
Shell> ./configure –with-apxs=/www/bin/apxs
Shell> make;make install;make clean
LoadModule cband_module modules/mod_cband.so
# mod_cband
CBandScoreFlushPeriod 1
CBandRandomPulse On
mkdir /var/www/scoreboard
chown apache:apache /var/www/scoreboard/
<VirtualHost 1.2.3.4>
ServerName
www.bojack.comServerAdmin
bojack@bojack.comDocumentRoot /var/www
CBandSpeed 1024 10 30
CBandRemoteSpeed 20kb/s 3 3
</VirtualHost>
<VirtualHost 1.2.3.4>
ServerName
www.bojack.comServerAdmin
bojack@bojack.comDocumentRoot /var/www
CBandLimit 100M
CBandExceededSpeed 128 5 15
CBandScoreboard /var/www/scoreboard
CBandPeriod 4W
</VirtualHost>
<VirtualHost 1.2.3.4>
ServerName
www.bojack.com ServerAdmin
bojack@bojack.com DocumentRoot /var/www
CBandLimit 100M
CBandExceededSpeed 128 5 15
CBandScoreboard /var/www/scoreboard
CBandPeriod 4W
<Location /cband-status>
SetHandler cband-status
</Location>
<Location /cband-status-me>
SetHandler cband-status-me
</Location>
</VirtualHost>