In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge points about how apache limits concurrent connections and download speed under Linux. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
Mod_limitipconn, an unofficial module of apache, controls concurrent connections according to the same source ip, bw_mod, which can limit bandwidth according to the source ip. They are all third-party modules of apache.
1. Download:
Wget
Wget
two。 Installation
# tar-zxvf mod_limitipconn-0.22.tar.gz
# cd mod_limitipconn-0.22
# vi makefile
Modify: apxs = "/ usr/local/apache2/bin/apxs" # here is the apxs path of your own apache to load the module
Or
# / usr/local/apache2/bin/apxs-I-c-a mod_limitipconn.c to load the module
# make
# make install
# tar-xvf mod_bw-0.7.tgz
# cd mod_bw
# / usr/local/apache2/bin/apxs-I-c-a / home/kenami/mod_bw/mod_bw.c
Next, open the configuration file httpd.conf of apache with vi
The following two lines were found:
Loadmodule limitipconn_module modules/mod_limitipconn.so
Loadmodule bw_module modules/mod_bw.so
3. Configuration
# paths to be controlled
Number of threads limited by maxconnperip 3 #
Noiplimit index.htm # does not restrict this file
Add under the virtual host configuration file:
Bandwidthmodule on
Forcebandwidthmodule on
Bandwidth all 10000 # Speed limit 10k
Minbandwidth all-1
The configuration parameters are described as follows:
A. Bandwidthmodule on | off
/ / whether to enable the bandwidth limit feature of mod_bw.
B. Bandwidth [from] [bytes/s]
Set to specify the maximum client bandwidth. 0 means there is no limit.
Bandwidth u: [user-agent] [bytes/s]
C. Minbandwidth [from] [bytes/s]
Sets the minimum value of the specified client bandwidth. A value of 0 means the maximum bandwidth of each client is 256bytes/s, and a value of-1 indicates a maximum of bandwith.
D. Largefilelimit [type] [minimum size] [bytes/s]
Sets the maximum bandwidth for accessing a file that exceeds a specific size, and the file type size is in kbytes
E. Maxconnection [from] [max]
Sets the maximum number of concurrent connections for a specified client
F. Forcebandwidthmodule [on | off]
The default bw module will apply all requests, and on can set the filter type
With regard to from, 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 Compact 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 either for all clients or for a virtual host
Example 1:
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 means:
Enable mod_bw, restrict all file types are also enabled
Maximum bandwidth of all clients is 300k, maximum concurrent connection is 100
The maximum bandwidth of 192.168.1.2 is 100k and the maximum concurrent connection is 5.
The maximum bandwidth of the client using firefox is 100k
The maximum bandwidth of the client using wget is 200k
The maximum bandwidth for files in avi format over 600k is 200kbyte/s.
Example 2:
Bandwidthmodule on
Forcebandwidthmodule on
Largefilelimit .avi 1 20000
Largefilelimit .mpg 1 20000
Servername
This example limits the virtual host, and the specified file types avi and mpg must have a maximum bandwidth of 20kforcebandwidthmodule on.
Example 3:
Bandwidthmodule on
Addoutputfilterbytype mod_bw text/html text/plain
Bandwidth all 5000
Servername
These are all the contents of the article "how to limit concurrent connections and download speeds in apache under Linux". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.