Mod_limitipconn, this is an unofficial module of Apache, based on the same source IP for concurrent connection control, Bw_mod, it can be based on the source IP bandwidth constraints, they are Apache Third-party modules.
Under the virtual host configuration file, add:
Bandwidthmodule on
Forcebandwidthmodule on
Bandwidth all 10000 #限速10K
Minbandwidth ALL-1
Configuration parameters are described as follows:
A. Bandwidthmodule on| Off
Whether to turn on the MOD_BW bandwidth throttling feature.
B. bandwidth [from] [BYTES/S]
Sets the maximum bandwidth for the specified client, 0 means no Limit
Bandwidth u:[user-agent] [BYTES/S]
C. minbandwidth [from] [BYTES/S]
Sets the minimum value for the specified client bandwidth, 0 for each client bandwidth maximum of 256bytes/s, and 1 for the maximum bandwith value
D. largefilelimit [Type] [Minimum Size] [bytes/s]
Sets the maximum bandwidth to access a file that exceeds a certain size, with a file type size of unit Kbytes
E. maxconnection [from] [Max]
Set the maximum number of concurrent connections for a specified client
F. Forcebandwidthmodule [on| OFF]
The default BW module will apply all requests, on to set the filter type
About from, that is, the client source can be divided into the following situations:
IP Specifies a single host
192.168.1.22
Specify network Segment
192.168.1.0/24 or
192.168.1.0/255.255.255.0
Domain Name Single host
Client1.jb51.net
Domain name specified range
. jb51.net
All clients
All
The above configuration can be configured for all clients as well as for a virtual host
Example one:
Bandwidthmodule on
Bandwidth All 307200
Bandwidth 192.168.1.2 102400
Bandwidth "U:^MOZILLA/5 (. *)" 102400
Bandwidth "U:wget" 204800
Forcebandwidthmodule on
Largefilelimit. avi 600 204800
Maxconnection all 100
Maxconnnection 192.168.1.2 5
The above configuration meaning:
Open MOD_BW, restrict all file types also open
All clients have a maximum bandwidth of 300k and a maximum concurrent connection of 100
The maximum bandwidth of the 192.168.1.2 is 100k and the maximum concurrent connection is 5
100k client Maximum bandwidth using Firefox
Maximum bandwidth for clients using wget is 200k
Maximum bandwidth for files exceeding 600k in AVI format is 200kbyte/s
Example two:
<virtualhost *>
Bandwidthmodule on
Forcebandwidthmodule on
Largefilelimit. avi 1 20000
Largefilelimit mpg 1 20000
Servername www.jb51.net
</Virtualhost>
This instance restricts the virtual host, specifying the file type AVI and the MPG maximum bandwidth of 20k,forcebandwidthmodule on must have.
Example three:
<virtualhost *>
Bandwidthmodule on
Addoutputfilterbytype MOD_BW text/html Text/plain
Bandwidth All 5000
Servername www.jb51.net
</Virtualhost>