apache2를 위한 트래픽 모듈 mod_cband
아파치1에서의 mod_throttle 처럼, 아파치2에서도 트래픽을 체크할 수 있는 모듈이 나왔습니다.
관련 사이트는 http://cband.linux.pl/ 입니다.
설치는 최신 버전을 다운 받고
tar xvfp mod-cband-0.9.7.4.tgz
cd mod-cband-0.9.7.4
./configure
make && make install
하시면 됩니다.
자세한 설정방법은 아래 링크에서 확인하시면 됩니다.
http://cband.linux.pl/documentation
Bandwidth Speed Configuration Example
<VirtualHost *:80>
DocumentRoot /var/www/xyz.org/
ServerName xyz.org
CustomLog /var/log/apache2/xyz.org.access combined
ErrorLog /var/log/apache2/xyz.org.access.error
RewriteEngine On
RewriteOptions inherit
# Maximal 1024kbps speed for this virtualhost
# Maximal 10 requests per second for this virtualhost
# Maximal 30 open connections for this virtualhost
CBandSpeed 1024 10 30
# Maximal 10kB/s speed, 3 requests/s and 2 open connections for any remote client
CBandRemoteSpeed 10kb/s 3 2
# Maximal 20kB/s speed, 2 requests/s and 3 open connections for remote
# clients from class googlebot_class :P
CBandClassRemoteSpeed googlebot_class 20kb/s 2 3
</VirtualHost>
Bandwidth Quota Configuration Example
per-virtualhost bandwidth limiting configuration
Next, you may define virtualhost's bandwidth limits, URL location and the path to scoreboard files for individual virtualhosts:
# specify default 'bandwidth exceeded' location
CBandDefaultExceededURL http://haha.org/bandwidth_exceeded.html
<VirtualHost *:80>
DocumentRoot /var/www/xyz.org/
ServerName xyz.org
CustomLog /var/log/apache2/xyz.org.access combined
ErrorLog /var/log/apache2/xyz.org.access.error
RewriteEngine On
RewriteOptions inherit
# 100MB virtualhost bandwidth limit
CBandLimit 100000
# redirect to http://abc.org/bandwidth_exceeded.html
# when the limit has been reached
CBandExceededURL http://abc.org/bandwidth_exceeded.html
# virtualhost's scoreboard file
CBandScoreboard /var/run/apache2/xyz.org.scoreboard
# a period of time after which the scoreboard will be cleared (30 minutes)
# (only in >=0.9.5-rc2)
CBandPeriod 30M
</VirtualHost>
PS. 또한 http://www.ivn.cl/apache/ 의 mod_bw 도 있습니다. 참고 하시길...