2008年9月15日月曜日

Apache2の帯域制限にmod_cbandを入れてみた!

前回の記事に続いてmod_cbandについてです。
FreeBSD6.3
Apache2.2
なサーバーに
mod_cbandのインストールを行う。
mod_cbandはPortsにもありましたのでこちらからインストールします。


#cd /usr/local/www/mod_cband
#make install clean

===> Vulnerability check disabled, database not found
=> mod-cband-0.9.7.5.tgz doesn't seem to exist in /usr/ports/distfiles/apache2.
=> Attempting to fetch from http://cband.linux.pl/download/.
fetch: http://cband.linux.pl/download/mod-cband-0.9.7.5.tgz: No address record
=> Attempting to fetch from http://www.sfr-fresh.com/unix/privat/.
mod-cband-0.9.7.5.tgz 100% of 69 kB 39 kBps
===> Extracting for mod_cband-0.9.7.5_1
=> MD5 Checksum OK for apache2/mod-cband-0.9.7.5.tgz.
=> SHA256 Checksum OK for apache2/mod-cband-0.9.7.5.tgz.
===> Patching for mod_cband-0.9.7.5_1
===> mod_cband-0.9.7.5_1 depends on file: /usr/local/sbin/apxs - found
===> Configuring for mod_cband-0.9.7.5_1
configure: WARNING: you should use --build, --host, --target
checking for i386-portbld-freebsd6.3-gcc... cc
checking for C compiler default output file name... a.out
:
:
config.status: creating Makefile
===> Building for mod_cband-0.9.7.5_1

/usr/local/sbin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/local/build-1/libtool --silent --mode=compile cc -prefer-pic -O2 -fno-strict-aliasing -pipe -I/usr/local/include/mysql -DHAVE_MYSQL_H -I/usr/include -I/usr/local/include/apache22 -I/usr/local/include/apr-1 -I/usr/local/include/apr-1 -I/usr/local/include -Wall -DDST_CLASS=3 -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
/usr/local/build-1/libtool --silent --mode=link cc -o src/mod_cband.la -rpath /usr/local/libexec/apache22 -module -avoid-version src/mod_cband.lo

write "make install" to install module

===> Installing for mod_cband-0.9.7.5_1
===> mod_cband-0.9.7.5_1 depends on file: /usr/local/sbin/apxs - found
===> Generating temporary packing list
===> Checking if www/mod_cband already installed
/usr/local/sbin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -i -a -n cband src/mod_cband.la
/usr/local/share/apache22/build/instdso.sh SH_LIBTOOL='/usr/local/build-1/libtool' src/mod_cband.la /usr/local/libexec/apache22
/usr/local/build-1/libtool --mode=install cp src/mod_cband.la /usr/local/libexec/apache22/
cp src/.libs/mod_cband.so /usr/local/libexec/apache22/mod_cband.so
cp src/.libs/mod_cband.lai /usr/local/libexec/apache22/mod_cband.la
cp src/.libs/mod_cband.a /usr/local/libexec/apache22/mod_cband.a
chmod 644 /usr/local/libexec/apache22/mod_cband.a
ranlib /usr/local/libexec/apache22/mod_cband.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/libexec/apache22

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

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/local/libexec/apache22/mod_cband.so
[activating module `cband' in /usr/local/etc/apache22/httpd.conf]
===> Registering installation for mod_cband-0.9.7.5_1
===> Cleaning for mod_cband-0.9.7.5_1

#cd /usr/local/etc/apache22/
#emacs httpd.conf

例:www.example.comに4週間で100MBの転送量制限をして、超えた場合には最大速度を 128kbps、リクエストを 5、同時接続数を 15 にする


# <VirtualHost 1.2.3.4>
ServerName www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www
CBandLimit 100M
CBandExceededSpeed 128 5 15
CBandScoreboard /var/www/scoreboard
CBandPeriod 4W
#</VirtualHost>



ドキュメントはこちら
mod_cband documentation.txt

CBandRemoteSpeed 1M 3 3
CBandExceededSpeed 


現在書きかけ中の記事です。


.

0 件のコメント: