插件下载地址  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 

下面是编译时报的错误,

1
2
3
4
apxs:Error: Command failed with rc=65536
.
make : *** [src/.libs /mod_cband .so] 错误 1

修改后 make  



编译安装 make install 



 3.修改配置文件(虚拟主机的配置文件)

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

 上面的XXXXX 代表你自己创建的网站

 添加以下代码

 

CBandSpeed 5096 10 30   代表最大带宽

CBandRemoteSpeed 200kb/s 3 3 代表每用户最大速度为200kb 最大每秒 3 个请求和最大每秒 3 个连接

如下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<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 服务

其他代码表示的功能请自行在百度一下