Load Mod_limitipconn in Apache and limit number of concurrent connections

Source: Internet
Author: User
Tags bz2

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.