From 3d01cd87f2cfcde9cb15a7b8d8b8ce83b128ebee Mon Sep 17 00:00:00 2001 From: radek Date: Sun, 29 Aug 2004 19:40:32 +0000 Subject: [PATCH] - mv apache{,1}-* Changed files: apache-mod_bandwidth-cleanlink.pl -> 1.4 apache-mod_bandwidth-doc.html -> 1.3 apache1-mod_bandwidth.spec -> 1.8 --- apache-mod_bandwidth-cleanlink.pl | 43 -- apache-mod_bandwidth-doc.html | 645 ------------------------------ apache1-mod_bandwidth.spec | 32 +- 3 files changed, 17 insertions(+), 703 deletions(-) delete mode 100644 apache-mod_bandwidth-cleanlink.pl delete mode 100644 apache-mod_bandwidth-doc.html diff --git a/apache-mod_bandwidth-cleanlink.pl b/apache-mod_bandwidth-cleanlink.pl deleted file mode 100644 index 6d0e9ca..0000000 --- a/apache-mod_bandwidth-cleanlink.pl +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl - -# -# A little daemon that I use to clean links created by the bandwidth -# module for Apache when they weren't removed properly by the server. -# (Ie: when a httpd process didn't terminated in the usual way.) -# -# Change the value of TIME to how often (in seconds) you want to -# do the cleaning. -# - -$TIME=120; - -$PS="ps auxw"; -$LINKDIR="/var/run/apache-mod_bandwidth/link"; - - -sub do_clean { - local(%ppid); - - open(INP, "$PS |"); - while() { - if (($process) =/^\S+\s+(\d+)\s+.+httpd\s/) { - $ppid{$process}=1; - } - } - close(INP); - - opendir(DIR, $LINKDIR); - local(@filename)=readdir(DIR); - closedir(DIR); - - for($i=0; $i <= $#filename; $i++) { - if ($filename[$i] =~ /^\d+$/) { - if (! $ppid{$filename[$i]}) { - unlink("$LINKDIR/$filename[$i]"); - } - } - } -} - -do_clean(); - diff --git a/apache-mod_bandwidth-doc.html b/apache-mod_bandwidth-doc.html deleted file mode 100644 index 33e2d7f..0000000 --- a/apache-mod_bandwidth-doc.html +++ /dev/null @@ -1,645 +0,0 @@ - - -CohProg SaRL - Network Consulting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
- - - - - - - - - - -
- - -
-
Mod_bandwidth documentation

-

- -Installation :

-WARNING: It is very important to give the lowest priority to mod_bandwidth -so other modules will have the time to do their job before the documents -are transmited ! For that reason, it is important to follow those steps :

-

    -
  1. APACI installation
    -
      -
    • Copy the file mod_bandwidth.c to your Apache source directory.
      -
    • Run the ./configure script with the following directives : --add-module=mod_bandwidth.c \
      --permute-module=BEGIN:bandwidth
      -
    • Compile and install Apache.

      -

    - APXS installation
    -
      -
    • Compile the module with :
      - /path_to_apache/bin/apxs -c /path/mod_bandwidth.c -o /path_to_apache/libexec/mod_bandwidth.so
      -
    • Add the following lines to your httpd.conf file :
      - LoadModule bandwidth_module libexec/mod_bandwidth.so
      - AddModule mod_bandwidth.c

      - Those directives should be placed at the begining of the list - so that the module will be given the lowest priority and be - executed after others modules.

      -

    - - Manual installation
    -
      -
    • Copy the file mod_bandwidth.c to the "src/modules/extra" directory of your Apache sources.
      -
    • Copy the "src/Configuration.tmpl" file to "src/Configuration"
      -
    • Edit the "src/Configuration" file and add near the begining :
      - AddModule modules/extra/mod_bandwidth.o
      - (This is the reverse of old Apache versions)
      -
    • Run the "./Configure" script
      -
    • Compile and install Apache -
    -

    -

  2. Create the needed directories and make sure that they are "read/write/execute" for the user under which Apache run. By default, mod_bandwidth use the following directories but they can be changed using the BandWidthDataDir configuration directive:

    - /tmp/apachebw
    - /tmp/apachebw/link
    - /tmp/apachebw/master

    - - Note that if any of those directories doesn't exist, or if they can't - be accessed by the server, the module is totaly disabled except for - logging an error message in the logfile. -

    - Be careful that on some systems the content of the /tmp directory - is deleted at boot time or every so often by a cronjob. If that the - case, either disable this feature or change the location of the - directories used by the module using the BandWidthDataDir configuration directive. -

-

- Global configuration directives :

- -

    -
  • BandWidthDataDir
    - Syntax : BandWidthDataDir <directory>
    - Default : "/tmp/apachebw"
    - Context : server config -

    - Sets the name of the root directory used by mod_bandwidth to store - its internal temporary information. Don't forget to create the needed - directories : <directory>/master and <directory>/link

    -

  • BandWidthModule
    - Syntax : BandWidthModule <On|Off>
    - Default : Off
    - Context : per server config

    - - Enable or disable totaly the whole module. By default, the module is - disable so it is safe to compile it in the server anyway. -

    - PLEASE, NOTE THAT IF YOU SET A BANDWIDTH LIMIT INSIDE A VIRTUALHOST - BLOCK, YOU ALSO __NEED__ TO PUT THE "BandWidthModule On" DIRECTIVE - INSIDE THAT VIRTUALHOST BLOCK ! -

    - IF YOU SET BANDWIDTH LIMITS INSIDE DIRECTORY BLOCKS (OUTSIDE OF - ANY VIRTUALHOST BLOCK), YOU ONLY NEED TO PUT THE "BandWidthModule On" - DIRECTIVE ONCE, OUTSIDE OF ANY VIRTUALHOST OR DIRECTORY BLOCK. -

    -

  • BandWidthPulse
    - Syntax : BandWidthPulse <microseconds>
    - Default :
    - Context : per server config

    - - Change the algorithm used to calculate bandwidth and transmit data. - In normal mode (old mode), the module try to transmit data in packets - of 1KB. That mean that if the bandwidth available is of 512B, the - module will transmit 1KB, wait 2 seconds, transmit another 1KB and - so one. -

    - Seting a value with "BandWidthPulse", will change the algorithm so - that the server will always wait the same amount of time between - sending packets but the size of the packets will change. - The value is in microseconds. - For example, if you set "BandWidthPulse 1000000" (1 sec) and the - bandwidth available is of 512B, the sever will transmit 512B, - wait 1 second, transmit 512B and so on. -

    - The advantage is a smother flow of data. The disadvantage is - a bigger overhead of data transmited for packet header. - Setting too small a value (bellow 1/5 of a sec) is not realy - useful and will put more load on the system and generate more - traffic for packet header. -

    - Note also that the operating system may do some buffering on - it's own and so defeat the purpose of setting small values. -

    - This may be very useful on especialy crowded network connection : - In normal mode, several seconds may happen between the sending of - a full packet. This may lead to timeout or people may believe that - the connection is hanging. Seting a value of 1000000 (1 sec) would - guarantee that some data are sent every seconds... -

    -

-Directory / VirtualServer configuration directives

-

    -
  • BandWidth
    - Syntax : BandWidth <domain|ip|all> <rate>
    - Default : none
    - Context : per directory, .htaccess

    - - Limit the bandwidth for files in this directory and - sub-directories based on the remote host <domain> or - <ip> address or for <all> remote hosts. -

    - Ip addresses may now be specified in the network/mask format. - (Ie: 192.168.0.0/21 ) -

    - The <rate> is in Bytes/second. - A <rate> of "0" means no bandwidth limit. -

    - Several BandWidth limits can be set for the same - directory to set different limits for different - hosts. In this case, the order of the "BandWidth" - keywords is important as the module will take the - first entry which matches the client address. -

    - Example :
    - <Directory /home/www>
    - BandWidth ecp.fr 0
    - BandWidth 138.195 0
    - BandWidth all 1024
    - </Directory>

    -

    - This will limit the bandwith for directory /home/www and - all it's subdirectories to 1024Bytes/sec, except for - .ecp.fr or 138.195..where no limit is set. -

    -

  • LargeFileLimit
    - Syntax : LargeFileLimit <filesize> <rate>
    - Default : none
    - Context : per directory, .htaccess

    - - Set a maximal <rate> (in bytes/sec) to use when transfering - a file of <filesize> KBytes or more. -

    - Several "LargeFileLimit" can be set for various files sizes - to create range. The rate used for a given file size will be - the one of the matching range. -

    - A <rate> of "0" mean that there isn't any limit based on - the size. -

    - A <rate> of "-1" mean that there isn't any limit for that type - of file. It's override even a BandWidth limit. I found this usefull - to give priority to very small files (html pages, very small pictures) - while seting limits for larger files... (users with their video files - can go to hell ! :) -

    - Example :
    - If the following limits are set :
    - LargeFileLimit 200 3072
    - LargeFileLimit 1024 2048

    - - That's mean that a file of less than 200KBytes won't be - limited based on his size. A file with a size between - 200KBytes (included) and 1023Kbytes (included) will be - limited to 3072Bytes/sec and a file of 1024Kbytes or more - will be limited to 2048Bytes/sec. -

    -

  • MaxConnection
    - Syntax : MaxConnection <connections>
    - Default : 0 (illimited)
    - Context : per directory, .htaccess

    - - Restrict the number of maximum simultanous connections. If the - limit is reached, new connections will be rejected. - - A value of 0 mean that there isn't any limits. -

    -

  • MinBandWidth
    - Syntax : MinBandWidth <domain|ip|all> <rate>
    - Default : all 256
    - Context : per directory, .htaccess

    - - Set a minimal bandwidth to use for transfering data. This - over-ride both BandWidth and LargeFileLimit rules as well - as the calculated rate based on the number of connections. -

    - The first argument is used in the same way as the first - argument of BandWidth. -

    - <rate> is in bytes per second. -

    - A rate of "0" explicitly means to use the default minimal - value (256 Bytes/sec). -

    - A rate of "-1" means that the minimal rate is equal to the - actual rate defined by BandWidth and LargeFileLimit. - In fact, that means that the final rate won't depend - of the number of connections but only on what was defined. -

    - Example :
    - If BandWidth is set to "3072" (3KBytes/sec) and MinBandWidth - is set to "1024" (1KBytes/sec) that means :
    - - if there is one connection, the file will be transfered - at 3072 Bytes/sec.
    - - if there is two connections, each files will be transfered - at 1536 Bytes/sec.
    - - if there is three or more connections, each files will be - transfered at 1024 Bytes/sec. (Minimal of 1024 Bytes/sec). -

    - If MinBandWidth is set to "-1" that means :
    - - if there is one connection, the file will be transfered - at 3072 Bytes/sec.
    - - if there is two or more connections, each files will be - transfered at 3072 Bytes/sec. In effect, the rate doesn't - depend anymore on the number of connections but only on - the configuration values. -

    - Note that the total transfer rate will never exceed your physical - bandwidth limitation. -

    - Note : If both a "BandWidth" and a "LargeFileLimit" limit apply, - the lowest one will be used. (But never lower than the - "MinBandWidth" rate) -

    - If both a virtual server limit is defined and another - apply for a directory under this virtual server, the - directory limit will over-ride it. -

    - If a limit is defined outside a Directory or VirtualHost - directive, it will act as default on a per virtual server - basis. (Ie: each virtual server will have that limit, - _independantly_ of the other servers) -

-

-Runing Apache with mod_bandwidth :

-For correct results, it is important that there isn't any "dead" links in -the "link" directory of mod_bandwidth when you start the server.

-It may be a good idee to run the "cleanlink.pl" script we provide to -automaticaly remove dead links
-

-
-
- - - -
-
- -
- -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - - - -

- - - -
-Web hosting | -Leased lines | -Produces | -Consulting | -Support | -About us | -Contact us -
-Our customers | -Webmail | -Apache mod_bandwidth -
-
-
-

-Copyright ©2000 CohProg Sàrl. All rights reserved.
- - diff --git a/apache1-mod_bandwidth.spec b/apache1-mod_bandwidth.spec index 7f4486a..06dafcb 100644 --- a/apache1-mod_bandwidth.spec +++ b/apache1-mod_bandwidth.spec @@ -1,8 +1,8 @@ %define mod_name bandwidth -%define apxs /usr/sbin/apxs +%define apxs /usr/sbin/apxs1 Summary: Apache module: bandwidth limits -Summary(pl): Modu³ do apache: limity pasma -Name: apache-mod_%{mod_name} +Summary(pl): Modu³ do Apache: limity pasma +Name: apache1-mod_%{mod_name} Version: 2.0.5 Release: 1 License: Apache @@ -16,17 +16,19 @@ Source2: %{name}.conf # http://www.cohprog.com/v3/bandwidth/doc-en.html Source4: %{name}-doc.html URL: http://www.cohprog.com/v3/bandwidth/intro-en.html -BuildRequires: apache(EAPI)-devel +BuildRequires: apache1-devel +BuildRequires: %{apxs} Requires(post,preun): %{apxs} Requires(post,preun): grep Requires(preun): fileutils -Requires: apache(EAPI) +Requires: apache1 Requires: crondaemon Requires: procps +Obsoletes: apache-mod_%{mod_name} <= %{version} BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %define _pkglibdir %(%{apxs} -q LIBEXECDIR) -%define _sysconfdir /etc/httpd +%define _sysconfdir /etc/apache %description "Mod_bandwidth" is a module for the Apache webserver that enable the @@ -63,22 +65,22 @@ rm -rf $RPM_BUILD_ROOT %post %{apxs} -e -a -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2 -if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*mod_%{mod_name}.conf" /etc/httpd/httpd.conf; then - echo "Include /etc/httpd/mod_%{mod_name}.conf" >> /etc/httpd/httpd.conf +if [ -f /etc/apache/apache.conf ] && ! grep -q "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf; then + echo "Include /etc/apache/mod_%{mod_name}.conf" >> /etc/apache/apache.conf fi -if [ -f /var/lock/subsys/httpd ]; then - /etc/rc.d/init.d/httpd restart 1>&2 +if [ -f /var/lock/subsys/apache ]; then + /etc/rc.d/init.d/apache restart 1>&2 fi %preun if [ "$1" = "0" ]; then %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2 umask 027 - grep -v "^Include.*mod_%{mod_name}.conf" /etc/httpd/httpd.conf > \ - /etc/httpd/httpd.conf.tmp - mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf - if [ -f /var/lock/subsys/httpd ]; then - /etc/rc.d/init.d/httpd restart 1>&2 + grep -v "^Include.*mod_%{mod_name}.conf" /etc/apache/apache.conf > \ + /etc/apache/apache.conf.tmp + mv -f /etc/apache/apache.conf.tmp /etc/apache/apache.conf + if [ -f /var/lock/subsys/apache ]; then + /etc/rc.d/init.d/apache restart 1>&2 fi fi -- 2.44.0