Saturday, November 22, 2025

Web Server-17.Configure mod_ratelimit

 

Apache httpd : Configure mod_ratelimit2022/03/16

 
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/httpd/conf.modules.d/00-optional.conf
# line 15 : uncomment

LoadModule ratelimit_module modules/mod_ratelimit.so
[root@www ~]# 
vi /etc/httpd/conf.d/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 ~]# 
systemctl restart httpd

[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.


No comments:

Post a Comment