Help - Search - Members - Calendar
Full Version: cPanel mod-throttle HOWTO
The Planet Forums > Control Panels > cPanel/WHM
GOT-Hosting
Thanks to Addict for the original HOWTO and demokrit for a clarification.

SSH into your box and do the following:

CODE
mkdir /temp

cd /temp

wget http://www.snert.com/Software/mod_throttle/mod_throttle312.tgz

tar zxvf mod_throttle312.tgz

cd mod_throttle-3.1.2

pico Makefile


Change the line that reads:

CODE
APXS=apxs


To read:

CODE
APXS=/usr/local/apache/bin/apxs


Then continue:

CODE
make

make install

service httpd restart


Then go to your WHM and verify that it lists mod_throttle as an installed module.

Usage

Best bet is to go to http://www.snert.com/Software/mod_throttle/ and read up on all the options, but I will give you an example of limiting a site, and how to monitor all your throttled sites status.

Edit your /etc/httpd/conf/httpd.conf and locate the virtualhost entry for the site you wish to throttle. Just [bold]before[/bold] the:

CODE
</virtualhost>


Line, insert the following:

CODE
<IfModule mod_throttle.c>

ThrottlePolicy Volume 10G 30d

</IfModule>

<Location /throttle-me>

SetHandler throttle-me

</Location>


The ThrottlePolicy line is the key. The first number is the amount of data and acceptable letters are G, M and K. The second number is the period and acceptable letters are m, w, d, h, and s.

Then restart Apache (service httpd restart) Now you can go to

CODE
http://throttleddomain.com/throttle-me


And see the status of the throttle.

If you want to be able to see the status of all throttled sites on the server at once, go to the first virtualhost entry in your httpd.conf file and add the following:

CODE
<Location /throttle-status>

SetHandler throttle-status

</Location>


Then restart Apache again, and you can go to http://host.name.com/throttle-status and see the status of all throttled sites.

Enjoy!
Paul
QUOTE (GOT-Hosting)
CODE
<IfModule mod_throttle.c>

ThrottlePolicy Volume 10G 30d

</IfModule>

<Location /throttle-me>

SetHandler throttle-me

</Location>
Does this work out an average bandwidth useage and then caps that account at that limit?

example:
You set the account at 50GB over 30 days, so in order to use 50GB in 30 days that account needs to throw out a constant 200kbps (example), so then mod_throttle will limit that account so it can only put out a max of 200kbps so that it can't go over it's 50GB allowance and won't run out of its allowance (i.e. hit 50GB on day 20)?

Because the short description for 'volume' gives the impression that when the account has transferred 50GB in that 30 day period it refuses any more requests (which is what cpanel/whm already does).
GOT-Hosting
Yes, but if you set it to 1 gb/day, it'll refuse all requests after that gig has passed and then will turn it back on again the next day.

Same thing hour by hour or minute by minute.
huaren
what code do I put to limit the max connection from each IP.

also, what code do I put to limit the max download speed from each IP ?

thanks for the help!
GOT-Hosting
I do not think that you can throttle based upon the receivers IP. It sure would be nice if it would though.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.