In this guide, I will show you how limit bandwidth in Apache and Nginx.


You need to install Apache web server and configure virtual host for your domain.

Please take a look on the manual.

Enable the mod_ratelimit module:

nano /etc/httpd/conf.modules.d/00-base.conf

Uncomment the line:

LoadModule ratelimit_module modules/mod_ratelimit.so

Add to your virtual host file:

<IfModule mod_ratelimit.c>
   <Location /downloads>
     SetOutputFilter RATE_LIMIT
     SetEnv rate-limit 200

Limit bandwidth as 200 KB/sec under the /download location.

Restart Apache

Ubuntu / Debian

systemctl restart httpd

RHEL & Centos & Fedora & AlmaLinux

systemctl restart apache2


In order to set a virtual host for Nginx web server, please take a look at this guide.

Limits the rate of response transmission to a client. The rate is specified in bytes per second.

Now add to server location:

location /downloads/ {
limit_rate 200k;

And restart Nginx.

systemctl restart nginx

Test limiting


The limit is disabled.


As you can see, it’s really easy to limit client download speed.