Using mod_bw to limit bandwith usage on apache
mod_bw can be downloaded from http://bwmod.sourceforge.net, installation requires a slight modification to the source code, basically comment out the entire block shown below
/* Compatibility for ARP < 1 */ /* #if (APR_MAJOR_VERSION < 1) #define apr_atomic_inc32 apr_atomic_inc #define apr_atomic_dec32 apr_atomic_dec #define apr_atomic_add32 apr_atomic_add #define apr_atomic_cas32 apr_atomic_cas #define apr_atomic_set32 apr_atomic_set #endif */
Then install it just like any other apache modules. It automatically add the LoadModule directive to httpd.conf
apxs -cia mod_bw.c
Then configure it in the <Directory/> block
%(apache)%
<VirtualHost 1.2.3.4:80>
# Turn on the module
BandWidthModule On
# Enable it for all mime types
ForceBandWidthModule On
# Alternatively, enable it for certain mime types
# AddOutputFilterByType MOD_BW text/html text/plain
# Upper limit of 128KB
Bandwidth localhost 0
Bandwidth all 131072
# Minimum bandwidth of 10KB
MinBandwidth all 10240
# Limit bandwidth for certain extension exceeding certain size.
# This limits *.flv files larger than 4M to a 64KB bandwidth
LargeFileLimit .flv 4096 65535
# Error document for bandwidth overflow
BandWidthError 510
# Limit concurrent connections
# MaxConnection all 25
</VirtualHost>BandWidthModule On
# Enable it for all mime types
ForceBandWidthModule On
# Alternatively, enable it for certain mime types
# AddOutputFilterByType MOD_BW text/html text/plain
# Upper limit of 128KB
Bandwidth localhost 0
Bandwidth all 131072
# Minimum bandwidth of 10KB
MinBandwidth all 10240
# Limit bandwidth for certain extension exceeding certain size.
# This limits *.flv files larger than 4M to a 64KB bandwidth
LargeFileLimit .flv 4096 65535
# Error document for bandwidth overflow
BandWidthError 510
# Limit concurrent connections
# MaxConnection all 25
%%
There are no comments on this page. [Add comment]