FTP: //ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c
Installation:
WARNING: It is very important to give the lowest priority to mod_bandwidth so other modules will have the time to do their job before the documents are transmited For that reason, it is important to follow those steps!:
Apaci Installation
Copy the file mod_bandwidth.c to your Apache source directory Run the ./configure script with the following directives:. --Add-module = mod_bandwidth.c / - permute-module = BEGIN: bandwidth Compile and install Apache APXS installation.
Compile the module with: / path_to_apache / bin / apxs -c /path/mod_bandwidth.c -o /path_to_apache/libexec/mod_bandwidth.so Add the following lines to your httpd.conf file: LoadModule bandwidth_module libexec / mod_bandwidth.soAddModule mod_bandwidth.c Those Directives SHOULD SO That The Module Will Be Given The Lowest Priority And Be Executed After Others Modules. Manual Installation
Copy the file mod_bandwidth.c to the "src / modules / extra" directory of your Apache sources. Copy the "src / Configuration.tmpl" file to "src / Configuration" Edit the "src / Configuration" file and add near the begining : AddModule modules / extra / mod_bandwidth.o (This is the reverse of old Apache versions) Run the "./Configure" script Compile and install Apache Create the needed directories and make sure that they are "read / write / execute" for the user under which Apache run By default, mod_bandwidth use the following directories but they can be changed using the BandWidthDataDir configuration directive:. / tmp / apachebw / tmp / apachebw / link / tmp / apachebw / master Note that if any of those directories doesn ' t exist, or if they can not be accessed by the server, the module is totaly disabled except for logging an error message in the logfile. Be careful that on some systems the content of the / tmp directory is deleted at boot time or every So offen by a cronjob. if That The Case, Either Disable this featu Re or Change the location of the directories use by the module Using the BandwidthDataDir Configuration Directive Directives:
BandWidthDataDirSyntax: BandWidthDataDir
(1 sec) and the bandwidth available is of 512B, the sever will transmit 512B, wait 1 second, transmit 512B and so on. The advantage is a smother flow of data. The disadvantage is a bigger overhead of data transmited for packet header. Setting too small a value (bellow 1/5 of a sec) is not realy useful and will put more load on the system and generate more traffic for packet header. Note also that the operating system may do some buffering on it's own and so defeat the purpose of setting small values This may be very useful on especialy crowded network connection:.. In normal mode, several seconds may happen between the sending of a full packet This may lead to timeout or people may believe that the connection is hanging Seting. A Value of 1000000 (1 Sec) Would Guarantee That Some Data Are Sent Every Seconds ... Directory / Virtual Server Configuration Directives
BandWidthSyntax: BandWidth
. S override even a BandWidth limit I found this usefull to give priority to very small files (html pages, very small pictures) while seting limits for larger files ... (users with their video files can go to hell :) Example!: If the following limits are set:. LargeFileLimit 200 3072LargeFileLimit 1024 2048 that's mean that a file of less than 200KBytes will not be limited based on his size A file with a size between 200KBytes (included) and 1023Kbytes (included) will be limited to 3072Bytes / sec and a file of 1024Kbytes or more will be limited to 2048Bytes / sec MaxConnectionSyntax:. MaxConnection
(1kbytes / sec) That Means: - IF The IS One Connection, The File Will Be Transfered At 3072 Bytes / Sec.- If The IS Two Connections, Each Files Will Be Transfered At 1536 BYTES / Sec.- IF There Is Three OR More connections, each files will be transfered at 1024 bytes / sec). IF Minbandwidth Is Set to "-1" That Means: - if The IS One Connection, The File Will Be Transfered At 3072 Bytes /sec.- if there is two or more connections, each files will be transfered at 3072 Bytes / sec. In effect, the rate does not depend anymore on the number of connections but only on the configuration values. Note that the total transfer rate will never exceed your physical bandwidth limitation Note:. If both a "bandWidth" and a "LargeFileLimit" limit apply, the lowest one will be used (But never lower than the "MinBandWidth" rate) If both a virtual server limit is. DEFINED AND ANOTHER APPLY for A DIRECTORY UNDER THIS VIRTUAL SERVER, THE DIRECTORY LIMIT WILL OVER-RIDE IT. IF A LIMIT I s defined outside a Directory or VirtualHost directive, it will act as default on a per virtual server basis. (Ie: each virtual server will have that limit, _independantly_ of the other servers) Runing Apache with mod_bandwidth:
For Correct Results, It is import "links in the" link "Directory of Mod_Bandwidth When You Start The Server.
IT May Be a Good Idee To Run The "CleanLink.pl" Script We provide to Automatic Remove Dead Links