If a Web site provides file downloads, it is very easy for users to use multi-threaded downloads, which can easily deplete resources, so limiting the number of threads to download (that is, limiting the number of concurrent connections to one IP) is important. (After the Apache compilation completes, adds the extra module)
1. Download the corresponding version
[Root@localhost ~]# wget http://dominia.org/djao/limit/mod_limitipconn-0.23.tar.bz2
2. Compile and install Apache extension Module
[Root@localhost ~]# Tar XF mod_limitipconn-0.23.tar.bz2
[Root@localhost ~]# CD mod_limitipconn-0.23
[Root@localhost mod_limitipconn-0.23]#/usr/local/apache/bin/apxs-c-i-a mod_limitipconn.c
(Apxs used to compile the module tool)
This step automatically compiles the mod_limitipconn.so module into Apache's corresponding modules, and automatically adds Loadmodules statements to the http.conf file, restarting the server, and finds the following figure
This column more highlights: http://www.bianceng.cn/Servers/web/
* Note: This command will automatically add the required information to your Apache configuration file httpd.conf and copy the generated mod_limitipconn.so module to the Apache module directory. However, to confirm that this command is working properly, first check your Apache module directory (mine is/usr/lib/apache) to see if the internal contains mod_limitipconn.so files,
3. Modify the configuration file
Extendedstatus on
<ifmodule limitipocnn_module>
<location/>
Maxconnperip 3
Noiplimit Image/*
</Location>
<Location/movie>
Maxconnperip 1
Onlyiplimit audio/mpeg Video
</Location>
</IfModule>
* Note: Maxconnperip is the number of IP concurrent connections that are restricted in the configuration file, that is, the number of thread connections allowed for downloading
4. Restart Service
Detailed configuration file
Number of per-IP concurrent connections restricted by Maxconnperip
Noiplimit image/* Do not make IP restrictions on pictures
<Location/movie> Restrictions on Movie directory
The number of concurrent connections with the Maxconnperip 1 limit is 1
Onlyiplimit audio/mpeg Video #该限制只对视频和音频格式的文件
If you view the original please point: http://blog.chinaunix.net/u/249/showart_1884370.html
http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=1989852
This article is from the "Linux" blog, please be sure to keep this source http://weihong.blog.51cto.com/6655355/1309078