WDCP V3 安裝mod-cband 插件(apache版本)

插件下載地址  http://down.51cto.com/data/2334352

本文講述的是 在使用wdcp網站環境下, 如何安裝mod-cband插件  

軟件版本號 

wdcp

 apache 2.4.23   

cband 

 mod-cband-0.9.6.1

在安裝前先介紹一下其他的 

wdcp的apache 目錄 

 /www/wdlinux/httpd-2.4.23

在安裝插件時 需要用到一個組件“apxs”,目錄爲

/www/wdlinux/httpd-2.4.23/bin/apxs

————————————————————————————————————————

接下來我們安裝插件 

  1. 創建下載插件的目錄

    mkdir -p /usr/local/share/soft

    cd /usr/local/share/soft

    並將軟件下載到當前目錄(當然了,你也可以自己創建,隨意)

  2. 安裝軟件

    a.解壓軟件 tar -zxvf mod-cband-0.9.6.1.tgz -C /usr/local/share/soft/

    b.進入目錄 /usr/local/share/soft/mod-cband-0.9.6.1

    c.配置 ./configure --with-apxs=/www/wdlinux/httpd-2.4.23/bin/apxs

    d.編譯 make 出現了錯誤,見下面 

     修改當前軟件的mod-cband.c  將裏面的配置文件修改一下(只需要修改提示行數,不要全部修改)

     remote_ip 改爲 client_ip

     remote_addr 改爲 client_addr

    e.編譯安裝 make install 

下面是編譯時報的錯誤,

/www/wdlinux/httpd-2.4.23/bin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/www/wdlinux/httpd-2.4.23/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/www/wdlinux/httpd-2.4.23/include  -I/www/wdlinux/httpd-2.4.23/include   -I/www/wdlinux/httpd-2.4.23/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_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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1010: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1010: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1014: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1014: warning: comparison with string literal results in unspecified behavior
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
src/mod_cband.c:3236: note: expected 'apr_size_t *' but argument is of type 'int *'
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] 錯誤 1

修改後 make  

/www/wdlinux/httpd-2.4.23/bin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/www/wdlinux/httpd-2.4.23/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/www/wdlinux/httpd-2.4.23/include  -I/www/wdlinux/httpd-2.4.23/include   -I/www/wdlinux/httpd-2.4.23/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_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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
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:68: note: expected 'int *' but argument is of type 'unsigned int *'
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1010: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1010: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1014: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1014: warning: comparison with string literal results in unspecified behavior
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
src/mod_cband.c:3236: note: expected 'apr_size_t *' but argument is of type 'int *'
/www/wdlinux/httpd-2.4.23/build/libtool --silent --mode=link gcc -std=gnu99    -o src/mod_cband.la  -rpath /www/wdlinux/httpd-2.4.23/modules -module -avoid-version    src/mod_cband.lo

write "make install" to install module

編譯安裝 make install 

/www/wdlinux/httpd-2.4.23/bin/apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -i -a -n cband src/mod_cband.la
/www/wdlinux/httpd-2.4.23/build/instdso.sh SH_LIBTOOL='/www/wdlinux/httpd-2.4.23/build/libtool' src/mod_cband.la /www/wdlinux/httpd-2.4.23/modules
/www/wdlinux/httpd-2.4.23/build/libtool --mode=install install src/mod_cband.la /www/wdlinux/httpd-2.4.23/modules/
libtool: install: install src/.libs/mod_cband.so /www/wdlinux/httpd-2.4.23/modules/mod_cband.so
libtool: install: install src/.libs/mod_cband.lai /www/wdlinux/httpd-2.4.23/modules/mod_cband.la
libtool: install: install src/.libs/mod_cband.a /www/wdlinux/httpd-2.4.23/modules/mod_cband.a
libtool: install: chmod 644 /www/wdlinux/httpd-2.4.23/modules/mod_cband.a
libtool: install: ranlib /www/wdlinux/httpd-2.4.23/modules/mod_cband.a
libtool: finish: PATH="/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/www/wdlinux/mysql/bin:/root/bin:/sbin" ldconfig -n /www/wdlinux/httpd-2.4.23/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /www/wdlinux/httpd-2.4.23/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.
----------------------------------------------------------------------
chmod 755 /www/wdlinux/httpd-2.4.23/modules/mod_cband.so
[activating module `cband' in /www/wdlinux/httpd-2.4.23/conf/httpd.conf]

 3.修改配置文件(虛擬主機的配置文件)

  /www/wdlinux/httpd-2.4.23/conf/vhost/XXXXX

 上面的XXXXX 代表你自己創建的網站

 添加以下代碼

 

CBandSpeed 5096 10 30   代表最大帶寬

CBandRemoteSpeed 200kb/s 3 3 代表每用戶最大速度爲200kb 最大每秒 3 個請求和最大每秒 3 個連接

如下代碼

<VirtualHost *:80>
DocumentRoot /www/web/cband_test_com/public_html
ServerName cband.quanttech.com
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
ErrorDocument 503 /errpage/503.html
php_admin_value open_basedir /www/web/cband_test_com:/tmp
CBandSpeed 5096 10 30
CBandRemoteSpeed 200kb/s 3 3
<IfModule mod_deflate.c>
    DeflateCompressionLevel 7
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
    AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
</IfModule>
</VirtualHost>
<Directory /www/web/cband_test_com>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

 重啓apache 服務

service httpd restart  

每次修改上面的參數 都要重啓一下apache 服務

其他代碼表示的功能請自行在百度一下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章