下载页面为:http://ivn.cl/2010/01/06/downloads-for-bandwidth-mod/ ,目前针对linux/unix的最新版本是0.92。

wget http://legacy.ivn.cl/files/source/mod_bw-0.92.tgz
tar zxvf mod_bw-0.92.tgz
apxs -i -a -c mod_bw.c 或
apxs2 -i -a -c mod_bw.c

配置参数非常丰富,可以满足很多需求,详见压缩包内的:mod_bw.txt

简单应用示例

Limit every user to a max of 10Kb/s on a vhost :

    <Virtualhost *>
      BandwidthModule On
      ForceBandWidthModule On
      Bandwidth all 10240
      MinBandwidth all -1
      Servername www.example.com
    </Virtualhost>

Limit al internal users (lan) to 1000 kb/s with a minimum of 50kb/s , and
files greater than 500kb to 50kb/s.

    <Virtualhost *>
      BandwidthModule On
      ForceBandWidthModule On
      Bandwidth all 1024000
      MinBandwidth all 50000
      LargeFileLimit * 500 50000
      Servername www.example.com
    </Virtualhost>

Limit avi and mpg extensions to 20kb/s.

    <Virtualhost *>
      BandwidthModule On
      ForceBandWidthModule On
      LargeFileLimit .avi 1 20000
      LargeFileLimit .mpg 1 20000
      Servername www.example.com
    </Virtualhost>

Using it the "right" way, with output filter by mime type (for text)
to 5kb/s:

    <Virtualhost *>
      BandwidthModule On
      AddOutputFilterByType MOD_BW text/html text/plain
      Bandwidth all 5000
      Servername www.example.com 
    </Virtualhost> 

标签: Linux管理维护

添加新评论