]>
Commit | Line | Data |
---|---|---|
11bc755d AG |
1 | |
2 | ||
3 | per-virtualhost bandwidth limiting configuration | |
4 | Next, you may define virtualhosts bandwidth limits, URL locations and path to the scoreboard file for individual virtualhosts: | |
5 | ||
6 | # specify default 'bandwidth exceeded' location | |
7 | CBandDefaultExceededURL http://haha.org/bandwidth_exceeded.html | |
8 | ||
9 | <VirtualHost *:80> | |
10 | DocumentRoot /var/www/xyz.org/ | |
11 | ServerName xyz.org | |
12 | CustomLog /var/log/apache2/xyz.org.access combined | |
13 | ErrorLog /var/log/apache2/xyz.org.access.error | |
14 | RewriteEngine On | |
15 | RewriteOptions inherit | |
16 | ||
17 | # 100MB virtualhost bandwidth limit | |
18 | CBandLimit 100000 | |
19 | ||
20 | # redirect to http://abc.org/bandwidth_exceeded.html | |
21 | # when the limit has been reached | |
22 | CBandExceededURL http://abc.org/bandwidth_exceeded.html | |
23 | ||
24 | # virtualhost's scoreboard file | |
25 | CBandScoreboard /var/run/apache2/xyz.org.scoreboard | |
26 | </VirtualHost> | |
27 | ||
28 | ||
29 | ||
30 | per-user bandwidth limiting configuration (only in 0.9.1 version) | |
31 | In 0.9.1 you can define limits for users and assign virtualhosts to them | |
32 | ||
33 | ||
34 | # define user 'dembol' | |
35 | <CBandUser dembol> | |
36 | # 200MB bandwidth limit for user 'dembol' | |
37 | CBandUserLimit 200000 | |
38 | ||
39 | # redirect to http://abc.org/bandwidth_exceeded.html | |
40 | # when the limit has been reached | |
41 | CBandUserExceededURL http://abc.org/bandwidth_exceeded.html | |
42 | ||
43 | # user's scoreboard file | |
44 | CBandUserScoreboard /var/run/apache2/dembol.scoreboard | |
45 | </CBandUser> | |
46 | ||
47 | ||
48 | ||
49 | # assign virtualhost 'xyz.org' to user 'dembol' | |
50 | <VirtualHost *:80> | |
51 | ServerName xyz.org | |
52 | # Specify virtualhost owner | |
53 | CBandUser dembol | |
54 | </VirtualHost> | |
55 | ||
56 | # assign virtualhost 'aga.org' to user 'dembol' | |
57 | <VirtualHost *:80> | |
58 | ServerName aga.org | |
59 | # Specify virtualhost owner | |
60 | CBandUser dembol | |
61 | </VirtualHost> | |
62 | ||
63 | ||
64 | ||
65 | per-user and per-virtualhost bandwidth limiting configuration (only in 0.9.1 version) | |
66 | In 0.9.1 you can also mix per-user and per-virtualhost bandwidth limiting techniques | |
67 | ||
68 | ||
69 | # define user 'dembol' | |
70 | <CBandUser dembol> | |
71 | # 200MB bandwidth limit for user 'dembol' | |
72 | CBandUserLimit 200000 | |
73 | ||
74 | # redirect to http://abc.org/bandwidth_exceeded.html | |
75 | # when the limit has been reached | |
76 | CBandUserExceededURL http://abc.org/bandwidth_exceeded.html | |
77 | ||
78 | # user's scoreboard file | |
79 | CBandUserScoreboard /var/run/apache2/dembol.scoreboard | |
80 | </CBandUser> | |
81 | ||
82 | ||
83 | # assign virtualhost 'xyz.org' to user 'dembol' | |
84 | <VirtualHost *:80> | |
85 | ServerName xyz.org | |
86 | # Specify virtualhost owner | |
87 | CBandUser dembol | |
88 | ||
89 | # 100MB virtualhost bandwidth limit | |
90 | CBandLimit 100000 | |
91 | ||
92 | # redirect to http://abc.org/bandwidth_exceeded.html | |
93 | # when the limit has been reached | |
94 | CBandExceededURL http://abc.org/bandwidth_exceeded.html | |
95 | ||
96 | # virtualhost's scoreboard file | |
97 | CBandScoreboard /var/run/apache2/xyz.org.scoreboard | |
98 | </VirtualHost> | |
99 | ||
100 | # assign virtualhost 'aga.org' to user 'dembol' | |
101 | <VirtualHost *:80> | |
102 | ServerName aga.org | |
103 | # Specify virtualhost owner | |
104 | CBandUser dembol | |
105 | </VirtualHost> |