Linux限制apache的每个IP访问的并发数
官方网站
http://dominia.org/djao/limitipconn2.html
wget http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
tar -zxvf mod_limitipconn-0.22.tar.gz
cd mod_limitipconn-0.22
#注意 apache 的安装要使用 –with-mod=so
#假设apache的安装目录是 /usr/local/apache
/usr/local/apache/bin/apxs -c -i -a mod_limitipconn.c
vi httpd.conf #确定下面的一行已经存在
LoadModule limitipconn_module lib/apache/mod_limitipconn.so
添加以下的行:
MaxConnPerIP 3 #每IP只允许3个并发连接
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
NoIPLimit image/*
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
去掉 #ExtendedStatus On 前面的#,使其生效
然后重启apache即可
最活跃的读者