CentOS 6
Sponsored Link

Limit BandWidth with mod_bw
2013/03/19
 
Limit Bandwidth or Connections with mod_bw.
[1] Install mod_bw (original config file includes many comments, so backup it and create new)
[root@www ~]#
yum --enablerepo=epel -y install mod_bw
 
# install from EPEL
[root@www ~]#
mv /etc/httpd/conf.d/mod_bw.conf /etc/httpd/conf.d/mod_bw.conf.org

[2] Limit bandwidth as 7000bytes/sec for test directory.
[root@www ~]#
vi /etc/httpd/conf.d/mod_bw.conf
LoadModule bw_module modules/mod_bw.so
<Directory "/var/www/html/test">
    BandWidthModule On
    ForceBandWidthModule On
    BandWidth all 7000
</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]
[3] Limit bandwidth as 102400bytes/sec and limit max connections as 10 for test directory.
[root@www ~]#
vi /etc/httpd/conf.d/mod_bw.conf
LoadModule bw_module modules/mod_bw.so
<Directory "/var/www/html/test">
    BandWidthModule On
    ForceBandWidthModule On
    BandWidth all 102400
    MaxConnection all 10
</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]
[4] Limit bandwidth as 102400bytes/sec only from host.example.com and 192.168.0.0/24 and files of ".wmv" which is over 1000Kbyte for test directory.
[root@www ~]#
vi /etc/httpd/conf.d/mod_bw.conf
LoadModule bw_module modules/mod_bw.so
<Directory "/var/www/html/test">
    BandWidthModule On
    ForceBandWidthModule On
    LargeFileLimit .wmv 1000 10240
    BandWidth host.example.com 10240
    BandWidth 192.168.0.0/24 10240
</Directory>
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]
Matched Content
 
Tweet