WDCP V3 安装mod
插件下载地址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
————————————————————————————————————————
接下来我们安装插件
[*] 创建下载插件的目录
mkdir -p /usr/local/share/soft
cd /usr/local/share/soft
并将软件下载到当前目录(当然了,你也可以自己创建,随意)
[*] 安装软件
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: *** 错误 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
3.修改配置文件(虚拟主机的配置文件)
/www/wdlinux/httpd-2.4.23/conf/vhost/XXXXX
上面的XXXXX 代表你自己创建的网站
添加以下代码
CBandSpeed 5096 10 30 代表最大带宽
CBandRemoteSpeed 200kb/s 3 3 代表每用户最大速度为200kb 最大每秒 3 个请求和最大每秒 3 个连接
如下代码
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
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
Options FollowSymLinks
AllowOverride All
Require all granted
重启apache 服务
service httpd restart
每次修改上面的参数 都要重启一下apache 服务
其他代码表示的功能请自行在百度一下
页:
[1]