"SfR Fresh" - the SfR Freeware/Shareware Archive 
Member "mod-cband-0.9.7.5/INSTALL" of archive mod-cband-0.9.7.5.tgz:
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1
2 $Id: INSTALL,v 1.6 2006/01/28 19:36:33 dembol Exp $
3
4 mod_cband - A per-user, per-virtualhost and per-destination bandwidth
5 limiter for the Apache HTTP Server Version 2
6
7
8
9 INSTALLATION
10 ============
11
12 Prerequisites
13
14 * Apache 2.0.54 - http://www.apache.org/
15 Other versions may work but have not been tested
16
17
18 Building
19
20 If you have got the apxs2 (APache eXtenSion tool) tool installed, write the following commands to build module:
21
22 $ wget http://cband.linux.pl/download/mod-cband-0.9.7.5.tgz
23 $ tar xzvf mod-cband-0.9.7.5.tgz
24 $ cd mod-cband-0.9.7.5
25 $ ./configure
26 $ make
27 $ make install
28
29 Otherwise, you must rebuild your Apache from source with something like this:
30
31 configure --add-module=../mod-cband/mod_cband.c --enable-shared=cband --enable-module=so
32
33
34 CONFIGURATION
35 =============
36
37 Configuration is very simple, you must write only several
38 lines. First, you must add following command to the main config file
39 to load mod_cband module. The path to mod_cband.so depends on your
40 apache installation.
41
42 LoadModule cband_module modules/mod_cband.so
43
44 --------------------------------------------------------
45
46 a) per-virtualhost bandwidth limiting configuration
47
48 Next, you may define virtualhosts bandwidth limits, URL locations and
49 path to the scoreboard file for individual virtualhosts:
50
51 # specify default 'bandwidth exceeded' location
52 CBandDefaultExceededURL http://haha.org/bandwidth_exceeded.html
53
54 <VirtualHost *:80>
55 DocumentRoot /var/www/xyz.org/
56 ServerName xyz.org
57 CustomLog /var/log/apache2/xyz.org.access combined
58 ErrorLog /var/log/apache2/xyz.org.access.error
59 RewriteEngine On
60 RewriteOptions inherit
61
62 # 100MB virtualhost bandwidth limit
63 CBandLimit 100000
64
65 # redirect to http://abc.org/bandwidth_exceeded.html
66 # when the limit has been reached
67 CBandExceededURL http://abc.org/bandwidth_exceeded.html
68
69 # virtualhost's scoreboard file
70 CBandScoreboard /var/run/apache2/xyz.org.scoreboard
71
72 # a period of time after which the scoreboard will be cleared (1 week) (only in >=0.9.5-rc2)
73 CBandPeriod 1W
74 </VirtualHost>
75
76 --------------------------------------------------------
77
78 b) per-user bandwidth limiting configuration (only in >=0.9.1 versions)
79 In >=0.9.1 versions you can define limits for users and assign virtualhosts to them
80
81 # define user 'dembol'
82 <CBandUser dembol>
83 # 200MB bandwidth limit for user 'dembol'
84 CBandUserLimit 200000
85
86 # redirect to http://abc.org/bandwidth_exceeded.html
87 # when the limit has been reached
88 CBandUserExceededURL http://abc.org/bandwidth_exceeded.html
89
90 # user's scoreboard file
91 CBandUserScoreboard /var/run/apache2/dembol.scoreboard
92
93 # a period of time after which the scoreboard will be cleared (4 days) (only in >=0.9.5-rc2)
94 CBandUserPeriod 4D
95 </CBandUser>
96
97 # assign virtualhost 'xyz.org' to user 'dembol'
98 <VirtualHost *:80>
99 ServerName xyz.org
100 # Specify virtualhost owner
101 CBandUser dembol
102
103 </VirtualHost>
104
105 # assign virtualhost 'aga.org' to user 'dembol'
106 <VirtualHost *:80>
107 ServerName aga.org
108 # Specify virtualhost owner
109 CBandUser dembol
110 </VirtualHost>
111
112 --------------------------------------------------------
113
114 c) per-user and per-virtualhost bandwidth limiting configuration (only in >=0.9.1 versions)
115 In >=0.9.1 versions you can also mix per-user and per-virtualhost bandwidth limiting techniques
116
117 # define user 'dembol'
118 <CBandUser dembol>
119 # 200MB bandwidth limit for user 'dembol'
120 CBandUserLimit 200000
121
122 # redirect to http://abc.org/bandwidth_exceeded.html
123 # when the limit has been reached
124 CBandUserExceededURL http://abc.org/bandwidth_exceeded.html
125
126 # user's scoreboard file
127 CBandUserScoreboard /var/run/apache2/dembol.scoreboard
128
129 # a period of time after which the scoreboard will be cleared (2 minutes) (only in >=0.9.5-rc2)
130 CBandUserPeriod 2M
131 </CBandUser>
132
133 # assign virtualhost 'xyz.org' to user 'dembol'
134 <VirtualHost *:80>
135 ServerName xyz.org
136 # Specify virtualhost owner
137 CBandUser dembol
138
139 # 100MB virtualhost bandwidth limit
140 CBandLimit 100000
141
142 # redirect to http://abc.org/bandwidth_exceeded.html
143 # when the limit has been reached
144 CBandExceededURL http://abc.org/bandwidth_exceeded.html
145
146 # virtualhost's scoreboard file
147 CBandScoreboard /var/run/apache2/xyz.org.scoreboard
148
149 # a period of time after which the scoreboard will be cleared (3 hours) (only in >=0.9.5-rc2)
150 CBandPeriod 3H
151 </VirtualHost>
152
153 # assign virtualhost 'aga.org' to user 'dembol'
154 <VirtualHost *:80>
155 ServerName aga.org
156 # Specify virtualhost owner
157 CBandUser dembol
158 </VirtualHost>
159
160 d) per-destination bandwidth limiting configuration (only in >= 0.9.5-rc1 versions)
161 In >= 0.9.5-rc1 you can limiting traffic to some destination classes. The destination classes
162 are defined by <CBandClass class_name> section. The limits for the classes are specified by
163 CBandClassLimit and CBandUserClassLimit commands
164
165 # define 'class_1'
166 <CBandClass class_1>
167 CBandClassDst 217.172.231.67
168 CBandClassDst 127/8
169 CBandClassDst 192.168.0.0/24
170 CBandClassDst 10.0.0.20
171 </CBandClass>
172
173 # define 'class_2'
174 <CBandClass class_2>
175 CBandClassDst 192.168.100.100
176 CBandClassDst 153.19/16
177 </CBandClass>
178
179 <CBandUser dembol>
180 CBandUserLimit 1000000
181 CBandUserExceededURL http://edns.pl/bandwidth_exceeded.html
182 CBandUserScoreboard /home/dembol/write/user.dembol.scoreboard
183
184 # 500MB limit for 'class_2'
185 CBandUserClassLimit class_2 500000
186 </CBandUser>
187
188 <VirtualHost *:80>
189 ...
190 CBandUser dembol
191
192 # 1GB limit for 'class_1'
193 CBandClassLimit class_1 1000000
194
195 # a period of time after which the scoreboard will be cleared (30 minutes) (only in >=0.9.5-rc2)
196 CBandPeriod 30M
197 </VirtualHost>
198
199
200 /cband-status handler
201 =====================
202
203 To view actual bandwidth limits, usages, users, scoreboards, add the
204 following lines into the config file:
205
206 <Location /cband-status>
207 SetHandler cband-status
208 </Location>
209
210 Then you can access the status page with a URL like:
211 http://server_name/cband-status
212
213 In >=0.9.5-rc1 versions you can also view /cband-status handler in the XML format:
214 http://server_name/cband-status?xml