Gentoo Archives: gentoo-server

From: Craig Webster <craig@××××××.net>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] Selective bandwidth management in Apache
Date: Fri, 03 Mar 2006 11:07:00
Message-Id: 64F3EC29-C1A0-4AFF-B4EB-F9F179CE6D65@xeriom.net
In Reply to: [gentoo-server] Selective bandwidth management in Apache by "A. Khattri"
1 On 3 Mar 2006, at 02:24, A. Khattri wrote:
2 > I have a web server with a virthost that has huge amounts of traffic
3 > because everyone (and his grandmother) links to images in that site.
4 >
5 > I was wondering if there was a clever way to check the referrer
6 > page and
7 > deny requests for pages that are *not* on the site?
8
9 What do you mean by clever?
10 The "dumb" way is doing something like this (not tested)
11
12 RewriteEngine On
13 RewriteCond %{REQUEST_URI} !\.(html|php|other)$ # Allow
14 requests for pages
15 RewriteCond %{HTTP_REFERER} !^$ # Allow if
16 referrer is blank (you might want to change this)
17 RewriteCond %{HTTP_REFERER} !^allowedsite.com$ # Allow if
18 referrer is known site
19 RewriteRule (.*) - [F] # Deny other
20 requests
21
22 > Ive also installed mod_throttle too and would love to manage total
23 > bandwidth per virthost (i.e. set a total of say, 5Gb per month, and
24 > after
25 > that deny requests).
26
27 It's not perfect but I think this will do nearly what you want
28
29 ThrottlePolicy Volume 5G 4W # Throttle based on volume of 5Gb over
30 4 weeks.
31
32 Yours,
33 Craig
34 --
35 Craig Webster | t: +44 (0)131 516 8595 | e: craig@××××××.net
36 Xeriom.NET | f: +44 (0)131 661 0689 | w: http://xeriom.net
37
38 "Te audire non possum. Musa sapientum fixa est in aure" - Unknown
39
40 --
41 gentoo-server@g.o mailing list

Replies

Subject Author
Re: [gentoo-server] Selective bandwidth management in Apache "A. Khattri" <ajai@××××.net>