在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>