Enable mod_ratelimit to limit bandwidth for clients in Apache httpd.
mod_ratelimit is included in the httpd package and can be configured quickly.
# Edit the optional module configuration
[root@www ~]# vi /etc/httpd/conf.modules.d/00-optional.conf
# Uncomment the following line to enable mod_ratelimit
LoadModule ratelimit_module modules/mod_ratelimit.so
# Create and edit the ratelimit configuration
[root@www ~]# vi /etc/httpd/conf.d/ratelimit.conf
# Add the following configuration
<IfModule mod_ratelimit.c>
<Location /download>
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 500
</Location>
</IfModule>
# Restart httpd to apply changes
[root@www ~]# systemctl restart httpd
In this example, the bandwidth is limited to 500 KB/sec under the /download location.
Access the /download location to ensure the bandwidth limitation is effective. Compare the download speeds from the limited /download location to an unlimited location for validation.
This setup configures Apache httpd to limit the bandwidth for specific locations, allowing for controlled distribution of server resources.