Apache mod_limitipconn

| | Comments (0)

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

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on August 20, 2004 1:49 AM.

MSN blog service was the previous entry in this blog.

一張網卡 bind 兩個不同網段的 IP is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.