DirectAdmin安装mod_limitipconn限制每个IP连接
1. 下载和安装mod_limitipconn
wget http://dominia.org/djao/limit/mod_limitipconn-0.24.tar.bz2 bzip2 -d mod_limitipconn-0.24.tar.bz2 tar xvf mod_limitipconn-0.24.tar cd mod_limitipconn-0.24 apxs -c -i -a mod_limitipconn.c chmod 755 /usr/lib/apache/mod_limitipconn.so
2. 应用每个用户
创建自定义用户 VirtualHost 模板
cd /usr/local/directadmin/data/templates cp virtual_host2*.conf custom cd custom
编辑 virtual_host2.conf ,在 VirtualHost 中添加以下内容
<IfModule mod_limitipconn.c> <Location /> MaxConnPerIP 10 NoIPLimit images/* </Location> </IfModule>
案例
#省略... <VirtualHost |IP|:|PORT_80| |MULTI_IP|> |CUSTOM| |?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/| ServerName www.|DOMAIN| ServerAlias www.|DOMAIN| |DOMAIN| |SERVER_ALIASES| ServerAdmin |ADMIN| DocumentRoot |DOCROOT| |CGI| |USECANONICALNAME| <IfModule !mod_ruid2.c> SuexecUserGroup |USER| |GROUP| </IfModule> <IfModule mod_limitipconn.c> <Location /> MaxConnPerIP 9 NoIPLimit images/* </Location> </IfModule> #省略...
重建所有用户 httpd.conf
cd /usr/local/directadmin/custombuild ./build rewrite_confs
重启Apache
service httpd restart
完成!