apache 2.4.x 에 mod_cband 설치시 error ( 설정 포함 )

apache 2.4.x의 경우 cband 컨파일시 에러를 확인할 수있다.

> configure 옵션은 apxs만 넣어줫음-0-

./configure –with-apxs=/usr/local/apache/bin/apxs

============== error 내용 =========================

/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:66: warning: type qualifiers ignored on function return type
src/mod_cband.c: In function ‘mod_cband_set_random_pulse’:
src/mod_cband.c:416: warning: cast to pointer from integer of different size
src/mod_cband.c: In function ‘mod_cband_set_limit’:
src/mod_cband.c:436: warning: pointer targets in passing argument 2 of ‘mod_cband_conf_get_limit_kb’ differ in signedness
src/mod_cband.c: In function ‘mod_cband_set_user_limit’:
src/mod_cband.c:651: warning: pointer targets in passing argument 2 of ‘mod_cband_conf_get_limit_kb’ differ in signedness
src/mod_cband.c: In function ‘mod_cband_set_class_limit’:
src/mod_cband.c:874: warning: pointer targets in passing argument 2 of ‘mod_cband_conf_get_limit_kb’ differ in signedness
src/mod_cband.c: In function ‘mod_cband_set_user_class_limit’:
src/mod_cband.c:899: warning: pointer targets in passing argument 2 of ‘mod_cband_conf_get_limit_kb’ differ in signedness
src/mod_cband.c: In function ‘mod_cband_get_dst’:
src/mod_cband.c:1281: error: ‘conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c: In function ‘mod_cband_get_remote_host’:
src/mod_cband.c:1310: error: ‘struct conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c:1311: error: ‘struct conn_rec’ has no member named ‘remote_ip’
src/mod_cband.c:1313: error: ‘struct conn_rec’ has no member named ‘remote_addr’
src/mod_cband.c: In function ‘mod_cband_filter’:
src/mod_cband.c:3236: warning: passing argument 3 of ‘b->type->read’ from incompatible pointer type
apxs:Error: Command failed with rc=65536

======================================================

이런식~

1)
/* addr = c->remote_addr->sa.sin.sin_addr.s_addr;*/ // 변경전
addr = c->client_addr->sa.sin.sin_addr.s_addr; // 변경후

2) :%s/remote_ip/client_ip/g << remote_ip변수를 client_ip로 변경

그리고 다시 make && make install

———————————————————————-
Libraries have been installed in:
/usr/local/apache/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.
———————————————————————-

> 모듈 위치확인 ( 설치시 경로 첫단에 경로확인 )
[msnote] /usr/local/src/mod-cband-0.9.7.5 🙂 # ll /usr/local/apache/modules/mod_cband.so
-rwxr-xr-x 1 root root 204644 1월 17 13:49 /usr/local/apache/modules/mod_cband.so*

> httpd.conf 파일에서 로드확인 ( 설치시 자동으로 삽입됨. 안되면 넣어줌 )
LoadModule cband_module modules/mod_cband.so

>관리자페이지


SetHandler cband-status
Order Deny,Allow
Deny from All
Allow from ipaddress

> 사용자페이지

SetHandler cband-status-me
Order deny,allow
Deny from all
Allow from all

※설정내용은 http://forbis.egloos.com/3408281 사이트를 참고함.
※ 각각의 호스트에 따로따로 설정해줄 때


ServerName foobar.com
ServerAlias www.foobar.com
DocumentRoot /home/foobar/public_html
ErrorLog logs/foobar-err
CustomLog logs/foobar-acc combined
CBandLimit 100Mi
CBandPeriod 1D

※ 위 설정은 1Day 동안 100M의 트래픽을 허용하겠다는 설정입니다.

※ 하나의 유저(foobar)가 여러개의 호스트를 사용하고 있는 경우 (트래픽 공유)

CBandUserLimit 100Mi
CBandUserPeriod 1D


ServerName foobar.com
ServerAlias www.foobar.com
DocumentRoot /home/foobar/public_html
ErrorLog logs/foobar-err
CustomLog logs/foobar-acc combined
CBandUser foobar


ServerName foobar2.com
ServerAlias www.foobar2.com
DocumentRoot /home/foobar2/public_html
ErrorLog logs/foobar2-err
CustomLog logs/foobar2-acc combined
CBandUser foobar

※ 위 설정은 foobar 유저에게 1Day 동안 100M의 트래픽을 허용하겠다는 설정이며,
foobar.com과 foobar2.com에서 foobar 유저의 트래픽을 공유해서 사용하겠다는 것입니다.

아까설정대로 웹에서 확인하면됨~끝끝

Leave your Comment

Your email address will not be published. Required fields are marked *