October 06, 2002
Quick and dirty guide to having a 100k/s throttle policy
Was doing this on multiple servers today, might as well get a blog entry out of it.
Note: this requires mod_so to be installed.. w/o that you'll need to do a lot more work.
To find out if you have mod_so, use /usr/local/apache/bin/httpd -l
- Download mod_throttle
http://www.snert.com/Software/mod_throttle/mod_throttle312.tgz - upack & unzip the tgz file
tar -xzvf mod_throttle312.tgz - Edit mod_throttle.c Change: (this is for a freebsd system)
#define USE_POSIX_SERIALIZATION
#undef USE_SYSTEM_V_SERIALIZATION - Edit Makefile
Important stuff:
1. APXS=/usr/local/apache/bin/apxs
2. APACHECTL=/usr/local/apache/bin/apachectl - make install (that's not a mistake, don't need to do make first).
You'll need to do this as root or using sudo since it edits the httpd.conf file. - Edit httpd.conf to set a throttle policy
#
# Throttle policy limits connections to 100k/s per IP address
# Keeps a history of 1000 ip addresses
#
<IfModule mod_throttle.c>
ThrottleClientIP 1000
ThrottlePolicy Speed 100K 1s
<Location /ts>
SetHandler throttle-status
</Location>
</IfModule>
- Restart apache
/usr/local/apache/bin/apachectl restart - You're now throttling the entire server to 100k/s per IP.
Posted October 06, 2002 11:02 PM in Apache
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/197
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/197