다운로드
http://freebsd.csie.nctu.edu.tw/distfiles/apache2/mod-cband-0.9.7.5.tgz
# ./configure --with-apxs=/usr/local/apache/bin/apxs
# make
# make install
# httpd.conf
LoadModule cband_module modules/mod_cband.so 모듈 확인
<IfModule mod_cband.c>
<Location /cband-status-me>
SetHandler cband-status-me
</Location>
<Location /~*/cband-status-me>
SetHandler cband-status-me
</Location>
<Location /cband-status>
SetHandler cband-status
Order deny,allow
Deny from all
Allow from 123.123.123
</Location>
</IfModule>
추가
# vi httpd-vhost.conf
<VirtualHost *>
ServerName mydomain.com
Document /home/www
CBandLimit 300Mi
CBandPeriod 1D
CBandExceededURL http://mydomain.com/traffic_exceeded.html
</VirtualHost>
설정
# /etc/init.d/httpd configtest
# /etc/init.d/httpd graceful
데몬 재실행
-------------------------------------------------------------------------------
에러 날경우
# make
/usr/local/apache/bin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/local/apache/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/apache/include -Wall -DDST_CLASS=3 -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1054: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1058: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1333: error: 'conn_rec' has no member named 'remote_ip'
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1362: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1363: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1365: error: 'struct conn_rec' has no member named 'remote_addr'
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] 오류 1
이런 에러가 발생하면 다음 파일에 들어가서 수정을 해줍니다.
# vi src/mod_cband.c
/* addr = c->remote_addr->sa.sin.sin_addr.s_addr; */ //변경 전 약 1300줄
addr = c->client_addr->sa.sin.sin_addr.s_addr; //변경 후
:%s/remote_ip/client_ip/g 4개(?)변경
(remote_ip 변수를 client_ip로 변경한다.)
:wq
아래의 URL에서 cband status 를 확인할 수 있습니다.
http://mydomain.com/cband-status
xml 데이터도 출력이 가능합니다.
http://mydomain.com/cband-status?xml
'리눅스' 카테고리의 다른 글
로그인시 bash 어쩌고 보이는 경우 (0) | 2015.04.24 |
---|---|
nfs 설치 설정 (0) | 2015.04.24 |
캐릭터셋 변경하기 (0) | 2015.04.20 |
파일시스템 오류 give root password for maintenance (0) | 2015.04.20 |
ssl 인증서 갱신 (0) | 2015.04.20 |