Friday, October 17, 2008

How Do I Make Myself More Mature

mod_cband apache in CentOS 5.2 Blocking p2p

mod_cband is a apache module allows us to control the bandwidth used by users connected to the server, either individually or in general.

Installation:

unload the module.
Project page: http://sourceforge.net/projects/cband/

# wget http://downloads.sourceforge.net/cband/mod-cband-0.9.6.1.tgz?modtime=1138205796&big_mirror = 0 Unzip



sources # tar-xvf mod-Cband-0.9.6.1.tgz

Installing required dependencies

# yum install http-devel

Compiling
sources
# . / configure

# make # make install

add the module to apache httpd.conf file, the default is automatically added to the compile line if it was not the case, add the following line

# vim / etc / httpd / conf / httpd.conf LoadModule

cband_module modules / mod_cband.so

It is also necessary to add

CBandScoreFlushPeriod 1


CBandRandomPulse On Restart the apache

# / etc / init.d / httpd restart Now

configure apache virtual domains: In my case

I have it in / etc / httpd / conf.d / virtual.conf
can be given for him in the httpd.conf pampering

Site Settings and Constraints

CBandSpeed \u200b\u200b1024kbps October 1930
CBandRemoteSpeed \u200b\u200b20kb / s March 3

CBandSpeed \u200b\u200bparameter is a global setting for this site, we define which users may not exceed 1024Kbps, 10 responses per second and 30 open connections.

CbandRemoteSpeed \u200b\u200bparameter is a setting for each user connected separately, define the individual user can download at most 20Kb / s to 3 requests per second and 3 connections allowed. So stay

our virtual host

# vim / etc / httpd / conf.d / virtual.conf

"<"VirtualHost *:80">"
DocumentRoot / var / www / html / miweb.com ServerName
miweb.com
www.miweb.com ServerAlias \u200b\u200bErrorLog logs
/ miweb.com_error.log
CustomLog logs / miweb.com_access.log Combined
CBandSpeed \u200b\u200b1024kbps October 1930
CBandRemoteSpeed \u200b\u200b50kb / s March 3
LogLevel warn
"<"/VirtualHost">"

Note: for some reason the place more or less does not come out, so add ">" and "Restart the <". para para que funcione no deben ir las comillas doble. Mucho ojo con eso.



apache # / etc / init.d / httpd restart

and test our web .... recommendations, we can change variables, restart apache and test.

Other options We

monthly traffic limit:

100M CBandLimit
Online
can see traffic and connections, etc. (Cband status) to: Create the folder



# mkdir / var / www / scoreboard

We permissions for the apache

# chown apache: apache / var / www / scoreboard

And add the virtual host

CBandScoreboard / var / www / scoreboard
CBandPeriod

4W "<"Location /cband-status">"
Cband-status SetHandler
"<"/Location">"
"<"Location /cband-status-me"> "SetHandler
Cband
-status-me" <"/Location"> "



All this is added to the virtual domain, being so:

"<"VirtualHost *:80">"
DocumentRoot / var / www / html / ServerName
miweb.com miweb.com
www.miweb.com
ServerAlias \u200b\u200bErrorLog logs / miweb.com_error.
log CustomLog logs / miweb.com_access.log Combined
CBandLimit 1000M
CBandSpeed \u200b\u200b1024kbps October 1930
CBandRemoteSpeed \u200b\u200b50kb / s March 3
LogLevel warn
CBandScoreboard / var / www / scoreboard 4W CBandPeriod

"<"Location /cband-status">"
Cband-status SetHandler
"<"/Location">"
"<"Location /cband-status-me">" SetHandler
Cband-status-me
"<"/Location">"
"<"/VirtualHost">"

Note: for some reason to put more or less do not appear, so add ">" and "Restart the <". para para que funcione no deben ir las comillas doble. Mucho ojo con eso.



apache # / etc / init.d / httpd restart

From the above limit to 1GB monthly traffic
to see statistics: http:// miweb.com / Cband-status or http://miweb.com/cband-status-me

A test ... Good luck

0 comments:

Post a Comment