- new, not tested yet
authorAdam Gołębiowski <adamg@pld-linux.org>
Sat, 10 Sep 2005 18:52:39 +0000 (18:52 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    apache-mod_cband.conf -> 1.1
    apache-mod_cband.conf.examples -> 1.1
    apache-mod_cband.spec -> 1.1

apache-mod_cband.conf [new file with mode: 0644]
apache-mod_cband.conf.examples [new file with mode: 0644]
apache-mod_cband.spec [new file with mode: 0644]

diff --git a/apache-mod_cband.conf b/apache-mod_cband.conf
new file mode 100644 (file)
index 0000000..4fb2b40
--- /dev/null
@@ -0,0 +1 @@
+LoadModule cband_module /usr/lib/apache/mod_cband.so
diff --git a/apache-mod_cband.conf.examples b/apache-mod_cband.conf.examples
new file mode 100644 (file)
index 0000000..fe715b0
--- /dev/null
@@ -0,0 +1,105 @@
+
+
+per-virtualhost bandwidth limiting configuration
+ Next, you may define virtualhosts bandwidth limits, URL locations and path to the scoreboard file for individual virtualhosts: 
+
+# specify default 'bandwidth exceeded' location
+CBandDefaultExceededURL http://haha.org/bandwidth_exceeded.html
+
+<VirtualHost *:80>
+    DocumentRoot /var/www/xyz.org/
+    ServerName xyz.org
+    CustomLog /var/log/apache2/xyz.org.access combined
+    ErrorLog /var/log/apache2/xyz.org.access.error
+    RewriteEngine On
+    RewriteOptions inherit
+
+    # 100MB virtualhost bandwidth limit
+    CBandLimit 100000
+
+    # redirect to http://abc.org/bandwidth_exceeded.html
+    # when the limit has been reached
+    CBandExceededURL http://abc.org/bandwidth_exceeded.html
+
+    # virtualhost's scoreboard file
+    CBandScoreboard /var/run/apache2/xyz.org.scoreboard
+</VirtualHost>
+
+
+per-user bandwidth limiting configuration (only in 0.9.1 version)
+ In 0.9.1 you can define limits for users and assign virtualhosts to them 
+
+# define user 'dembol'
+<CBandUser dembol>
+    # 200MB bandwidth limit for user 'dembol'
+    CBandUserLimit 200000
+
+    # redirect to http://abc.org/bandwidth_exceeded.html
+    # when the limit has been reached
+    CBandUserExceededURL http://abc.org/bandwidth_exceeded.html
+
+    # user's scoreboard file
+    CBandUserScoreboard /var/run/apache2/dembol.scoreboard
+</CBandUser>
+
+
+
+# assign virtualhost 'xyz.org' to user 'dembol'
+<VirtualHost *:80>
+    ServerName xyz.org
+    # Specify virtualhost owner
+    CBandUser dembol
+</VirtualHost>
+
+# assign virtualhost 'aga.org' to user 'dembol'
+<VirtualHost *:80>
+    ServerName aga.org
+    # Specify virtualhost owner
+    CBandUser dembol
+</VirtualHost>
+
+
+per-user and per-virtualhost bandwidth limiting configuration (only in 0.9.1 version)
+ In 0.9.1 you can also mix per-user and per-virtualhost bandwidth limiting techniques 
+
+# define user 'dembol'
+<CBandUser dembol>
+    # 200MB bandwidth limit for user 'dembol'
+    CBandUserLimit 200000
+
+    # redirect to http://abc.org/bandwidth_exceeded.html
+    # when the limit has been reached
+    CBandUserExceededURL http://abc.org/bandwidth_exceeded.html
+
+    # user's scoreboard file
+    CBandUserScoreboard /var/run/apache2/dembol.scoreboard
+</CBandUser>
+
+
+# assign virtualhost 'xyz.org' to user 'dembol'
+<VirtualHost *:80>
+    ServerName xyz.org
+    # Specify virtualhost owner
+    CBandUser dembol
+    
+    # 100MB virtualhost bandwidth limit
+    CBandLimit 100000
+
+    # redirect to http://abc.org/bandwidth_exceeded.html
+    # when the limit has been reached
+    CBandExceededURL http://abc.org/bandwidth_exceeded.html
+
+    # virtualhost's scoreboard file
+    CBandScoreboard /var/run/apache2/xyz.org.scoreboard
+</VirtualHost>
+
+# assign virtualhost 'aga.org' to user 'dembol'
+<VirtualHost *:80>
+    ServerName aga.org
+    # Specify virtualhost owner
+    CBandUser dembol
+</VirtualHost>
diff --git a/apache-mod_cband.spec b/apache-mod_cband.spec
new file mode 100644 (file)
index 0000000..f24c6c2
--- /dev/null
@@ -0,0 +1,75 @@
+%define                mod_name        cband
+%define        apxs            /usr/sbin/apxs
+%define                _pkglibdir      %(%{apxs} -q LIBEXECDIR)
+%define                _sysconfdir     %(%{apxs} -q SYSCONFDIR)
+
+Summary:       Apache module: bandwidth limits per vhosts
+Summary(pl):   Modu³ do Apache: limity pasma per vhosty
+Name:          apache-mod_%{mod_name}
+Version:       0.9.1
+Release:       0.1
+License:       Apache
+Group:         Networking/Daemons
+Source0:       http://cband.linux.pl/download/mod_%{mod_name}-%{version}.tgz
+# Source0-md5: 8f00b72f194719ee99d52a6175a74dbb
+Source1:       %{name}.conf
+Source2:       %{name}.conf.examples
+URL:           http://cband.linux.pl/
+BuildRequires: apache-devel >= 2.0.0
+BuildRequires: %{apxs}
+Requires(post,preun):  %{apxs}
+Requires(post,preun):  grep
+Requires(preun):       fileutils
+Requires:      apache >= 2.0.0
+Requires:      crondaemon
+Requires:      procps
+Obsoletes:     apache-mod_%{mod_name} <= %{version}
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+mod_cband is an Apache 2 module provided to solve the problem of
+limiting users' and virtualhosts' bandwidth usage. When the configured
+virtualhost's transfer limit is exceeded, mod_cband will redirect all
+further requests to a location specified in the configuration file.
+
+%description -l pl
+mod_cband to modu³ maj±cy za zadanie ograniczanie zu¿ycia pasma przez
+u¿ytkowników i virtualhostów. Gdy okre¶lony limit zostanie
+przekroczony, mod_cband przekieruje wszelkie zapytania do strony
+wskazanej w pliku konfiguracyjnym.
+
+%prep
+%setup -q -n mod_%{mod_name}-%{version}
+cp %{SOURCE2} .
+
+%build
+%{apxs} -c mod_%{mod_name}.c
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/httpd.conf}
+
+install .libs/mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/97_mod_%{mod_name}.conf
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+if [ -f /var/lock/subsys/apache ]; then
+       /etc/rc.d/init.d/apache restart 1>&2
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+       umask 027
+       if [ -f /var/lock/subsys/apache ]; then
+               /etc/rc.d/init.d/apache restart 1>&2
+       fi
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc *.examples
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*mod_*.conf
+%attr(755,root,root) %{_pkglibdir}/*
This page took 0.085539 seconds and 4 git commands to generate.