進階搜尋
找商品說明
價錢: -
此分類無可選擇屬性
請輸入 javascript 語法
記事本   >>  網站技術
在 apache 2.4.x 中安裝 mob_cband - CentOS 6
mod_cband 是個 apache 做流量管理的擴充元件

在 apache 2.2x 中沒什麼問題,在 apache 2.4 會有點問題,記錄如下

  1. 下載 mod_cband 原始碼
    沒有 yum 來源、 rpm 下載也不能安裝 ( in 2015/07/10)
    所以只能下載原始碼
    下載源很多都失效,找到一個來源還可以用。

  2. 解壓縮
    # tar xzvf mod-cband-0.9.7.4.tgz

  3. # cd mod-cband-0.9.7.4
  4. # ./configure
  5. make
  6. make install

幸運的話以上就完成了,不過 apache 2.4x 在第 5步就會出問題

apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -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:1046:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
               ^
src/mod_cband.c:1046:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'G') || (unit == "" && kb >= mult*mult)) {
                                                 ^
src/mod_cband.c:1050:15: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
               ^
src/mod_cband.c:1050:49: warning: comparison with string literal results in unspecified behavior [-Waddress]
     if ((unit != "" && unit[0] == 'M') || (unit == "" && kb >= mult)) {
                                                 ^
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1325:47: error: 'conn_rec' has no member named 'remote_ip'
     p.add.sin.s_addr = inet_addr(r->connection->remote_ip);
                                               ^
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1354:10: error: 'struct conn_rec' has no member named 'remote_ip'
     if (c->remote_ip != NULL)
          ^
src/mod_cband.c:1355:20: error: 'struct conn_rec' has no member named 'remote_ip'
  addr = inet_addr(c->remote_ip);
                    ^
src/mod_cband.c:1357:10: error: 'struct conn_rec' has no member named 'remote_addr'
  addr = c->remote_addr->sa.sin.sin_addr.s_addr;
          ^
src/mod_cband.c: In function 'mod_cband_update_speed':
src/mod_cband.c:1886:19: warning: variable 'time_last_request' set but not used [-Wunused-but-set-variable]
     unsigned long time_last_request;
                   ^
src/mod_cband.c: In function 'mod_cband_check_connections_speed':
src/mod_cband.c:2944:19: warning: variable 'time_now' set but not used [-Wunused-but-set-variable]
     unsigned long time_now;
                   ^


這時需要修改原始碼
  1. # cd src
  2. vi mod_cband.c
    搜尋 "remote_ip" 改成  "client_ip"

    找到
    else
            addr = c->remote_addr->sa.sin.sin_addr.s_addr;
    to
        else
            addr = c->client_addr->sa.sin.sin_addr.s_addr;
  3. 儲存、離開

接下來繼續

make
make install
就能成功。

會員登入