Apache Combined with MOD

zhaozj2021-02-17  48

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

BandwidthDataDir "/ Tmp / Apachebw /" BandwidthModule ON

C.3) Modify settings

# Do not limit the download speed of the local network users Bandwidth 192.168.0 0 # Limit other users' download speed of 8192 bytes per second Bandwidth all 8192 ....

Modify other section in the above way

d) Restart Apache:

Apachectl Configtest Apachectl Restart

--------------------------------------------------

MOD_BANDWIDTH Options Equipment:

..............................

BandwidthDataDir format: BandwidthDataDir Default: "/ tmp / apachebw" context: Server config

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 Default: OFF Context: Per Server Config Allow or disable modules.

..............................

Bandwidthpulse format: Bandwidthpulse Default: 1000 context: per server config

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 Default: no context: per directory, .htaccess

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:

# Connection from DUALFACE.com Do not limit the download speed Bandwidth Dualface.com 0 # From 192.168.0.0) network segment connection No download speed Bandwidth 192.168.0.0/16 0 # Other Connection restriction download speed is 1024 bytes per second Bandwidth all 1024 #, the higher the set priority, the higher

..............................

LargeFileLimit format: LargeFileLimit Default: no context: per directory, .htaccess

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 Default: 0 (no restriction) Context: per Directory, .htaccess

When the number of connections exceeds the specified connection, the new connection is rejected.

..............................

MINBANDWIDTH format: MinBandWidth Default: all 256 context: per directory, .htaccess

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

转载请注明原文地址:https://www.9cbs.com/read-29746.html

New Post(0)