mod_cband是一个通过Apache 2模块来解决限制用户和虚拟主机带宽问题的应用,当前版本可以调整虚拟主机和用户带宽限额,最高下载速度(like in mod_bandwidth),每秒访问请求速度和最高并发访问ip连接数(like in mod_limitipconn)。 
"我告诉主机服务提供商使用mod_cband,想要限制他们用户数据传输,像“每月10 Gb流量”这样。但已有了mod_curb模块,可以限制流量,但无法工作在虚拟主机和Apache 2下,所以我写了自己的模块完全适合于Apache 2 API同时支持每用户和每虚拟主机带宽限制。"(此段翻译自官方网站) 
FreeBSD ports path and pkg-descr info 
/usr/ports/www/mod_cband 
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. 
好了,说道这里我想这个模块的精髓之处在于完美的支持Apache 2并实现了原有两个模块的全部功能(2in1)且支持每用户和每虚拟主机带宽限制。这在进行web平台应用与整合之时给我们提供了又一易用的方法。准备动手吧!文中实例与系统平台均基于freebsd6.1平台。 
提示: 
在进行实际操作之前请确保你的ports tree已经同步到当前版本。具体方法请参考http://cnsnap.cn.freebsd.org/doc ... ok/ports-using.html,关于freebsd和apache2的安装本文不予介绍,同时假定你已经安装并配置了所需环境。 
安装: 
#cd /usr/ports/www/mod_cband 
#make install clean 
安装结束后末尾输出: 
chmod 755 /usr/local/libexec/apache2/mod_cband.so 
[activating module `cband’ in /usr/local/etc/apache2/httpd.conf] 
===> Registering installation for mod_cband-0.9.7.3 
此时cband_module已经自动添加到你的httpd.conf文件中并开启了。 
LoadModule cband_module libexec/apache2/mod_cband.so 
至此mod_cband安装已经完成,让我们继续后面的操作。之前说mod_cband易用是相对的,主要是看你如何配置让他为你所用。一些基础配置还是很容易完成,但是要发挥它的强大和灵活配置还是要好好看看documentation,充分理解良好驾驭。不��嗦了,下面看看如何进行基本配置和使用并观测实际效果。以我这个blog为实例,看看基本情况: 
<VirtualHost *:80> 
DocumentRoot “/other/blog/wordpress” 
ServerName blog.citygrit.cn 
<Directory “/other/blog/wordpress”> 
allow from all 
Options +Indexes 
</Directory> 
# 100MB virtualhost bandwidth limit 
CBandLimit 100M 
# Maximal 1024kbps speed for this virtualhost 
# Maximal 10 requests per second for this virtualhost 
# Maximal 30 open connections for this virtualhost 
CBandSpeed 1024 10 30 
# Maximal 10kB/s speed, 3 requests/s and 2 open connections for any remote client 
CBandRemoteSpeed 10kb/s 3 2 
# a period of time after which the scoreboard will be cleared (4 weeks) 
CBandPeriod 4W 
#Then you can access the status page with a URL like:http://server_name/cband-status 
<Location /cband-status> 
SetHandler cband-status 
</Location> 
#Then you can access the status page with a URL like:http://server_name/cband-status-me 
<Location /cband-status-me> 
SetHandler cband-status-me 
</Location> 
</VirtualHost> 
为了便于理解将上面内容里与mod_cband相关设置予以说明,(约定“#”为注释标记)。 
# 100MB virtualhost bandwidth limit 
CBandLimit 100M 
限制虚拟主机总访问带宽为100Mb。 
# Maximal 1024kbps speed for this virtualhost 
# Maximal 10 requests per second for this virtualhost 
# Maximal 30 open connections for this virtualhost 
CBandSpeed 1024 10 30 
限制此虚拟主机最高访问速度1024kbps 
限制此虚拟主机每秒最高接受请求数10个 
限制此虚拟主机最高并发连接30个 
# Maximal 10kB/s speed, 3 requests/s and 2 open connections for any remote client 
CBandRemoteSpeed 10kb/s 3 2 
限制来自远端访问速度10kB每秒,3个请求每秒,2个连接。 
# a period of time after which the scoreboard will be cleared (4 weeks) 
CBandPeriod 4W 
设定多久对所记录的全局访问带宽进行重设(清零)。 
4W=4 weeks 4周(一个月) 
#Then you can access the status page with a URL like:http://server_name/cband-status 
<Location /cband-status> 
SetHandler cband-status 
</Location> 
开启了mod_cband的实时监测功能,可以通过http://server_name/cband-status进行直观的观测。(全局监测) 
#Then you can access the status page with a URL like:http://server_name/cband-status-me 
<Location /cband-status-me> 
SetHandler cband-status-me 
</Location> 
开启了mod_cband的实时监测功能,可以通过http://server_name/cband-status-me进行直观的观测。(单一监测)