1, configure nginx.conf
code as follows http{ ............. limit_zone one $binary_remote_addr 10m; //I remember the default configuration, just commented out, if not added.............. server{ ............... .. location { ......... limit_conn one 20; //Connection limit limit_rate 500k; //Bandwidth limit ........ } ............ ..... } ............. }
[root@localhost nginx]# /etc/init.d/nginx reload //Reload
2, test limit ip connection number
Code is as follows [root@localhost nginx]# webbench -c 100 -t 2 http://127.0.0.1/index.php Webbench - Simple Web Benchmark 1.5 Copyright ( c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://127.0.0.1/index.php 100 clients, running 2 sec.
Speed=429959 pages /min, 2758544 bytes/sec. Requests: 14332 susceed, 0 failed.
[root@localhost nginx]# cat /var/log/nginx/access.log|
Grep 503 |
More //There are a lot of such data, it is best to add more or less 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" ; "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012:17:52:21 +0800] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" - 127.0.0.1 - - [25/Apr/2012: 17:52:21 +0800 ] "GET /index.php HTTP/1.0" 503 213 "-" "WebBench 1.5" -
................. .................................................. ...........................
Through the above test, it can be concluded that there is no problem in limiting the number of ip connections, but Limit bandwidth can't be seen, to be honest, this is not a good test, so it has not been tested
Use apache to limit IP concurrency and download traffic control
Install mod_limitipconn to limit the number of IP connections
1, download address: http://dominia.org/djao/limitipconn2.html
2, installation: [root@BlackGhost mod_limitipconn-0.22]# /usr/local/apache2/bin/apxs - c -i mod_limitipconn.c
3, the configuration is as follows vi httpd.conf
The code is as follows ExtendedStatus On LoadModule limitipconn_module modules/mod_limitipconn.so <IfModule mod_limitipconn.c> <Location /> #对根目录 MaxConnPerIP 6 #Maximum number of concurrent NoIPLimit im Age/* #No restrictions on images </Location> <Location /download> #downloadMaxConnPerIP 1 to the root directory #maximum number of concurrency 1 </Location> </IfModule>
Description: After unpacking mod_limitipconn-0.22.tar.gz, there is a README inside the file to be configured, and you can change it according to your own needs. If it doesn't, you can check it online, like apache. There are so many people, I think your problems have been encountered by others, and you can definitely find them. If you want to put the virtual host for maximum concurrency control, you can modify extra/httpd-vhost.conf to copy <IfModule mod_limitipconn.c> to <Virtualhost>
Install mod_bandwidth
mod_bandwidth can control the number of concurrent IPs, control the download traffic, and control the traffic of a directory.
1, download address: http://bwmod.sourceforge.net/
2, installation: [root@BlackGhost mod_bw]# /usr/local/apache2/bin/apxs -c -i mod_bw.c
3, configure the following vi httpd.conf plus LoadModule bw_module modules/mod_bw.so and then open vi httpd-vhosts.conf
code is as follows listen 10004 NameVirtualHost *:10004 <VirtualHost *:10004> DocumentRoot "/home/zhangy/www/test" ServerName *:10004 BandwidthModule On ForceBandWidthModule On Bandwidth all 1024000 MinBandwidth all 50000 LargeFileLimit * 500 50000 MaxConnection all 6 ErrorLog "/home/zhangy/apache/Www.test.com-error.log" CustomLog "/home/zhangy/apache/www.test.com-error.log" common </VirtualHost>
After decompressing the compressed file of bandwidth, inside There is a mod_bw.txt with detailed instructions and examples, the following are some of the parameter description:
1, BandWidth localhost 0 # not limited to localhost 2, BandWidth 192.168.1.5 102400 #对192.168 .1.5 rate limit is 100KB
3, BandWidth “u:^Mozilla(.*)” 10240 # speed limit 10KB with mozilla 4, BandWidth “u:wget” 102400 #If you download with wget Time limit 10KB
5, MinBandWidth all -1 # Guaranteed maximum speed of each client up to 10KB 6, LargeFileLimit .jpg 100 10240 #jpg file over 100KB, speed limit 10KB
7 ##The following 510 is quite good, if not set, apache will report an error, the root report is 404, the page is very ugly ErrorDocument 510 /exceed_speed.html BandWidthError 510
8,MaxConnection all 10 #All ip max The number of connections is 10 9, MaxConnection 192.168.1.5 5 #192.168.1.5 The maximum number of connections is 5
Intel E7/E3 series processors have been listed this year, and the market is also o
Previously just looking at the boring text version of the server returned the stat
Programs to open or close Windows Features Internet Information Services. IIS7 in
Click on the group and click on New Group in the right frame to creat
Automatic backup of website and database scripts under CentOS
Modify the remote desktop terminal port and log in to the
IIS W3SVC service due to performance counter error and crashed
What is the difference between a server and a PC on the hard disk?
The WmiApRpl service has been successfully loaded or deleted. Reference
After installing SVN, Apache can't start mod
Novice must see: proxy server use full Raiders
Explore your web server vulnerability in depth
Pseudo-static URL rewriting technology implementation method php asp
The server could not find the existing file
Reasons and solutions for not being authorized to view this page
Connection may not be enabled or the computer is too busy (resolving remote desktops cannot connect)
Win10 Spartan browser pressure: IE users more than twice the size of Chrome!
Analysis of the reasons for Windows 8.1 update failure
How to encrypt compressed files in win7 Ultimate?
Using the Windows 7 system's System account skills
Win10 is about to be released, Microsoft reviews 2014 and Outlook 2015
Three major measures make the Win2003 server efficient and practical
Win7 system boot screen shows 0xcoooo428 error how to do
Win8 connection network printer