Debian 11 Bullseye
Sponsored Link

Apache2 : Configure mod_ratelimit2021/09/08

 
Enable [mod_ratelimit] module to limit bandwidth for clients.
[1] [mod_ratelimit] is included in httpd package, so it's possible to configure quickly.
root@www:~#
vi /etc/apache2/conf-available/ratelimit.conf
# create new

# for example, limit bandwidth as [500 KB/sec] under the [/download] location

<IfModule mod_ratelimit.c>
    <Location /download>
        SetOutputFilter RATE_LIMIT
        SetEnv rate-limit 500
    </Location>
</IfModule> 

root@www:~#
a2enconf ratelimit

Enabling conf ratelimit.
To activate the new configuration, you need to run:
  systemctl reload apache2

root@www:~#
a2enmod ratelimit

Considering dependency env for ratelimit:
Module env already enabled
Enabling module ratelimit.
To activate the new configuration, you need to run:
  systemctl restart apache2

root@www:~#
systemctl restart apache2

[2] Access to the location to make sure the settings is effective.
The lower one is downloading from the limited location, the upper is downloading from a unlimited location.
Matched Content