カスタム検索
このエントリーをはてなブックマークに追加
tomo.gif (1144 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)To previous pageTo home pageMailing to me

トラフィック制御する方法(bw)

Created: 9 September 2007


"mod_bw"のダウンロード

"mod_bw"は以下からダウンロードできます。

http://apache.ivn.cl/

2007年9月9日に、"mod_bw-0.8.gz" がダウンロードできました。


"mod_bw"のインストール

以下の手順で実行すればインストールまで完了します。

# tar zxvf mod_bw-0.8.gz
# cd mod_bw
# apxs -i -a -c mod_bw.c
/usr/lib/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall 
        -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 
        -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables  -DLINUX=2 
        -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd  
        -I/usr/include/apr-1   -I/usr/include/apr-1   
        -c -o mod_bw.lo mod_bw.c && touch mod_bw.slo
/usr/lib/apr-1/build/libtool --silent --mode=link gcc -o mod_bw.la  
        -rpath /usr/lib/httpd/modules -module -avoid-version    mod_bw.lo
/usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' 
        mod_bw.la /usr/lib/httpd/modules
/usr/lib/apr-1/build/libtool --mode=install cp mod_bw.la /usr/lib/httpd/modules/
cp .libs/mod_bw.so /usr/lib/httpd/modules/mod_bw.so
cp .libs/mod_bw.lai /usr/lib/httpd/modules/mod_bw.la
cp .libs/mod_bw.a /usr/lib/httpd/modules/mod_bw.a
chmod 644 /usr/lib/httpd/modules/mod_bw.a
ranlib /usr/lib/httpd/modules/mod_bw.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib/httpd/modules/mod_bw.so
[activating module `bw' in /etc/httpd/conf/httpd.conf]
# 


設定する

"/etc/httpd/conf.d/bw.conf"を以下のように作成します。

LoadModule bw_module  /usr/lib/httpd/modules/mod_bw.so

BandWidthModule On

ForceBandWidthModule On

BandWidth localhost 0               ← ローカルホストからは無制限(0)
BandWidth 192.168.0.26 10240        ← 特定のIPアドレスからの要求で制限
BandWidth "u:^Mozilla/5(.*)" 10240  ← ブラウザの種類で制限

LargeFileLimit .avi 500 10240    ← 拡張子によって制限(500以上なら制限する)

<Location /test1>
    BandWidth 192.168.0.0/24 10000
    MaxConnection 192.168.0.0/24 10
</Location>

BandWidth    all 102400
MinBandWidth all 50000

ErrorDocument 510 /errors/maxconexceeded.html
BandWidthError 510

To previous pageTo home pageMailing to meJump to Top of pageline.gif (927 ツバツイツト)line.gif (927 ツバツイツト)tomo.gif (1144 ツバツイツト)
カスタム検索



このエントリーをはてなブックマークに追加