Results 1 to 4 of 4
-
4th Jul 2010, 03:01 PM #1OPMemberWebsite's:
Wrestle-Zone.net Media-Zone.netApache - Limiting Number of Connections
Hi,
I was wondering if someone can shed some light.
I want to limit the max numbers of connection an IP can establish to just 30.
How can i do that...
Debian Lenny, apache 2.29
Now the problem i face 3 times a month is.
I have a 100Mbit line, and I stream UFC/TNA/WWE Ppvs. just before the ppv starts i get hit by a wave of 1000+ users, along with 100+ already accessing my Flash Media Server that causes a bottleneck.
So I'm upgrading to 1Gbit, but would also appreciate some advice on this.
EGEvilGenius Reviewed by EvilGenius on . Apache - Limiting Number of Connections Hi, I was wondering if someone can shed some light. I want to limit the max numbers of connection an IP can establish to just 30. How can i do that... Debian Lenny, apache 2.29 Rating: 5
-
4th Jul 2010, 03:03 PM #2BannedWebsite's:
KWWHunction.comMeh, PM me or Add me to msn ill help you out bud
-
5th Jul 2010, 06:27 AM #3OPMemberWebsite's:
Wrestle-Zone.net Media-Zone.netanyone else........?
-
5th Jul 2010, 06:48 AM #4MemberWebsite's:
gudz.orgYou can limit a specific number of downloads per IP in the Apache configuration file (httpd.conf) and have different rules for each directory if you want. So if you have a directory called /videos you can create a ruleset for that directory in particular limiting the concurrent downloads to 1 for example. Then you can create another rule for a directory like /archive which you can limit image downloads to 5, there are all kinds of things you can set and lots of rules available! Understanding the limitipconn Rules
There are many different configurations you can use for this, I’ll go over a few ones I think would be more useful.
Example configuration:
---------------------------------------------------------------------------
ExtendedStatus On
# Only needed if the module is compiled as a DSO
LoadModule limitipconn_module lib/apache/mod_limitipconn.so
AddModule mod_limitipconn.c
<IfModule mod_limitipconn.c>
<Location /somewhere>
MaxConnPerIP 3
# exempting images from the connection limit is often a good
# idea if your web page has lots of inline images, since these
# pages often generate a flurry of concurrent image requests
NoIPLimit image/*
</Location>
<Location /mp3>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
</IfModule>
---------------------------------------------------------------------------
Installing mod_limitipconn.c
Installing this was quick and easy. Login to your server through shell as the root user.
# wget tar xzvf mod_limitipconn-0.04.tar.gz
# cd mod_limitipconn-0.04
# vi Makefile
Find
APXS = apxs
CHANGE TO:
APXS = /usr/local/apache/bin/apxs
Save
#make
#make install
This adds the module to httpd.conf and backs up the old configuration from httpd.conf.new
# vi /usr/local/apache/conf/httpd.conf
It should have added the following:
LoadModule limitipconn_module libexec/mod_limitipconn.so
and
AddModule mod_limitipconn.c
Now we need to setup the configuration for the site you want to add the limits to. Search the domain you want and go to the configuration for it in httpd.conf
You should be at the part like this:
<VirtualHost IP HERE>
ServerAlias www.domain.com domain.com
Add the following configuration that you want, this restricts 2 directories I have on my site to prevent users from downloading more than 1 video at a time, I have 2 separate rules.
<IfModule mod_limitipconn.c>
<Location /videos>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
<Location /forums/media/data>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
</IfModule>
So my whole entry for the domain looks like this:
<VirtualHost IPHERE>
ServerAlias www.domain.com domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /home/domain/public_html
BytesLog domlogs/domain.com-bytes_log
ServerName www.domain.com
<IfModule mod_php4.c>
php_admin_value open_basedir "/home/domain:/usr/lib/php:/usr/local/lib/php:/tmp"
</IfModule>
<IfModule mod_limitipconn.c>
<Location /videos>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
<Location /forums/media/data>
MaxConnPerIP 1
# In this case, all MIME types other than audio/mpeg and video*
# are exempt from the limit check
OnlyIPLimit audio/mpeg video
</Location>
</IfModule>
User domain
Group domain
CustomLog domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
</VirtualHost>
Save httpd.conf
Test Apache Configuration
# apachectl configtest start
Make sure it comes back ok without errors
# /scripts/restartsrv_httpd
Apache will restart. Try it out. Go to your limited directory and try to download 2 things (2 depends on your IP limit you set). You should get forwarded to a 503 Temporary Service page. We can customize that as well
Customizing the 503 Temporary Service Page
FTP to your webspace and edit your public_html/.htaccess file
Add the following to the top:
ErrorDocument 503 http://www.domain.com/bandwidth.php
Save the file and upload it.
Create a page called bandwidth.php or html, or whatever you want. Put a message saying you’re preventing bandwidth abuse and limiting downloads to 1 at a time.
Make sure everything is working well and go relax, you did a good job and managed to save your server a lot of bandwidth and yourself some cash!
About the Author:
Steven Leggett is the editor of the server resource and hosting tutorial site, www.webhostgear.com and specializes in system administration and web development.
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
is paypal not limiting filehoster's account now a days??
By shufol in forum File Host DiscussionReplies: 6Last Post: 7th May 2012, 05:50 PM -
PayPal limiting accounts of filehosts?
By MaX. in forum File Host DiscussionReplies: 76Last Post: 27th Feb 2012, 06:19 PM -
Remote SQL connections
By Time in forum Technical Help Desk SupportReplies: 7Last Post: 22nd Mar 2011, 03:56 PM -
Show off your connections speed
By WHosting.com in forum General DiscussionReplies: 21Last Post: 8th Aug 2010, 06:42 PM -
VB Limiting permissions : urgent Help :D
By Crazy4 in forum vBulletinReplies: 4Last Post: 13th Sep 2009, 09:39 AM
themaCreator - create posts from...
Version 3.52 released. Open older version (or...