在http://dominia.org/djao/limit/   寻找你匹配的安装包

 安装apache

 yum install -y httpd-*

 启动apache 

 下载http://dominia.org/djao/limit/mod_limitipconn-0.24.tar.bz2

解压安装包后有

ChangeLog  INSTALL  LICENSE  Makefile    README

yum安装apache 所以直接安装INSTALL中提示,make install

如果是编译安装 

tar xavf httpd-2.4.2.tar.bz2

tar xavf mod_limitipconn-0.24.tar.bz2

cd httpd-2.4.2

./configure --with-module=aaa:../mod_limitipconn-0.24/mod_limitipconn.c

make

make install

httpd.conf设置

# This command is always needed

ExtendedStatus On

 

# Only needed if the module is compiled as a DSO

LoadModule limitipconn_module lib/apache/mod_limitipconn.so

 

<IfModule mod_limitipconn.c>

 

    # Set a server-wide limit of 10 simultaneous downloads per IP,

    # no matter what.

    MaxConnPerIP 10   

#单ip最大限制数

    <Location /somewhere>

        # This section affects all files under http://your.server/somewhere

        MaxConnPerIP 3

        # exempting p_w_picpaths from the connection limit is often a good

        # idea if your web page has lots of inline p_w_picpaths, since these

        # pages often generate a flurry of concurrent p_w_picpath requests

        NoIPLimit p_w_picpath/*

#不受限制的目录

    </Location>

 

    <Directory /home/*/public_html>

        # This section affects all files under /home/*/public_html

        MaxConnPerIP 1

        # In this case, all MIME types other than audio/mpeg and video*

        # are exempt from the limit check

        OnlyIPLimit audio/mpeg video 指定特殊文件

    </Directory>

</IfModule>