Apache mod_limitipconn

Vote 0 Votes

mod_limitipconn 是 Apache 限制 IP 連線數的 Module,
Client 端使用多線的下載會對 Server 造成較高的 Loading, 其實速度也不見得會比較快

把 mod_limitipconn 編入 httpd
tar xzvf httpd-2.2.17.tar.gz
tar xjvf mod_limitipconn-0.23.tar.bz2
cd httpd-2.2.17
./configure --with-module=aaa:../mod_limitipconn-0.23/mod_limitipconn.c \
--prefix=/usr/local/apache --sysconfdir=/usr/local/apache/conf \
--enable-ssl --enable-rewrite --enable-proxy --enable-expires --enable-headers
make install

加到 httpd.conf, 本例是每個 IP 限制 4 個連線, 圖檔不限制
MaxConnPerIP 4
NoIPLimit image/*

重啟 Apache 後, 查看 phpinfo() 若 Loaded Modules 有看到 mod_limitipconn 表示已經有載入
使用多線下載軟體如 Flashget 測試, 線程開超過限制的量, 觀察 access log,
若看到到 Apache status code 503 (Service Temporarily Unavailable)
即表示運作正常, 超出的線程被限制住了.

Leave a comment

About this Entry

This page contains a single entry by Pank published on February 18, 2011 12:00 PM.

Pure Shutdown Screen Saver was the previous entry in this blog.

Free traffic meter for Windows 7 is the next entry in this blog.

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

Monthly Archives