http://dominia.org/djao/limitipconn.html
這個 mod 可以用來檔 flashget, net transport, netants 之類的多線程下載程式,
開太多線, 對 server 造成負擔, 又不會比較快
FreeBSD
cd /usr/ports/www/mod_limitipconn && make install
編輯 httpd.conf
LoadModule limitipconn_module libexec/apache/mod_limitipconn.so
AddModule mod_limitipconn.c
ExtendedStatus On
新增
<IfModule mod_limitipconn.c>
<Location />
MaxConnPerIP 2
</Location>
<Location /cgi-bin>
MaxConnPerIP 2
</Location>
</IfModule>
若有 VirtualHost, 請加到對應的 block
apachectl restart 後, 測試一下
log 裡面會發現 503, 就是被限制的線程
220.130.142.100 - - [20/Aug/2004:01:32:43 +0800] "GET /test.rar HTTP/1.1" 503 395
220.130.142.100 - - [20/Aug/2004:01:32:49 +0800] "GET /test.rar HTTP/1.1" 503 395
220.130.142.100 - - [20/Aug/2004:01:32:55 +0800] "GET /test.rar HTTP/1.1" 503 395
220.130.142.100 - - [20/Aug/2004:01:33:02 +0800] "GET /test.rar HTTP/1.1" 503 395
220.130.142.100 - - [20/Aug/2004:01:33:08 +0800] "GET /test.rar HTTP/1.1" 503 395
220.130.142.100 - - [20/Aug/2004:01:33:14 +0800] "GET /test.rar HTTP/1.1" 503 395