Author: lownr Date: 2003/04/10
--------------------------------------------------
Summary:
Control the flow of download through Apache by a bandwidth control module.
--------------------------------------------------
surroundings:
FreeBSD 4.7 GCC 2.95.4 Apache 1.3.27 Mod_Bandwidth 2.0.4
--------------------------------------------------
step
1, download module mod_bandwidth
ftp://ftp.cohprog.com/pub/apache/module/
2, compilation and installation
a) Compile: Since apache is installed with compiled bag, only APXS mode is compiled
/ usr / local / sbin / apxs -c mod_bandwidth.c -o /usr/local/libexec/apache/mod_bandwidth.so
b) Creating a directory that runs MOD_BANDWIDTH:
MKDIR / TMP / APACHEBW MKDIR / TMP / APACHEBW / LINK MKDIR / TMP / APACHEBW / MASTER CHMOD -R 777 / TMP / APACHEBW
c) Modify /usR/local/etc/apache/httpd.conf file:
C.1) Add the following content loadModule Bandwidth_Module Libexec / Apache / MOD_BANDWIDTH.SO AddModule MOD_BANDWIDTH.C
Note: Both lines must be added to the forefront of the corresponding area, so that this module operates at the lowest priority.
C.2) Add the following
C.3) Modify
Modify other
d) Restart Apache:
Apachectl Configtest Apachectl Restart
--------------------------------------------------
MOD_BANDWIDTH Options Equipment:
..............................
BandwidthDataDir format: BandwidthDataDir
Set MOD_BANDWIDTH to save the directory of the runtime data. You need to create ./master and ./link two subdirectories in this directory and set to 777.
Note: Some systems are cleaned up / TMP directory timed, so they best set BandWidThDataDIR to else in these systems.
..............................
BandwidthModule format: BandwidthModule
..............................
Bandwidthpulse format: Bandwidthpulse
Change the time interval for calculating the calculation bandwidth, default is 1000 milliseconds (1 second). Use lower intervals to get more accurate bandwidth control, but consume more CPU time, and vice versa.
Note: For details of this option, please refer to MOD_BANDWIDTH documentation.
..............................
Bandwidth Format: Bandwidth
Restrict this rate of downloading in this directory.
Domain specifies which domain connection is affected by this setting. IP specifies which IP address (or IP segment) connection is affected. All connections are affected.
Example:
..............................
LargeFileLimit format: LargeFileLimit
For files that exceed the specified size, the rate is used when downloading. If the rate setting is 0, no limit, but the download speed is still subject to the influence of the BANDWIDTH setting. If set to -1, it is completely unaffected. By setting different file sizes and rates, you can set the download speed of files within a different size range.
Example:
#File size is more than or equal to 200 kilobytes, download rate is 3072 bytes per second LargefileLimit 200 3072LargefileLimit 1024 2048
..............................
MaxConnection Format: MaxConnection
When the number of connections exceeds the specified connection, the new connection is rejected.
..............................
MINBANDWIDTH format: MinBandWidth
Set the minimum bandwidth, the default is 256 bytes per second. According to the rate set by BANDWIDTH and LARGEFILILIMIT. MOD_BANDWIDTH accounts for allowed connections. For example, BandWidth is 4096 bytes, while MinBandWidth is 1024 bytes, the maximum number of concurrent connections is 4. Note: For details of this option, please refer to MOD_BANDWIDTH documentation.
--------------------------------------------------
Reference:
MOD_BANDWIDTH DOCUMENTS
http://www.cohprog.com/v3/bandwidth/doc-en.html