How to limit bandwidth per connection on Apache (ratelimit)

Milad Soltanian
1 min readFeb 27, 2021

Hi, I hope you doing well :)

for some reasons we wanted to deploy a public fileserver … everything was okay till we noticed that some of our users get 100 kb/s speed from our server :D

well the reason was that the ones with high speed network would take all of the bandwidth for their own … so I was looking for a solution to deploy on the webserver and I saw mod_ratelimit module , it just done what I wanted .

here is the steps that I gone through to achieve this goal ( WHM installed on the server ) :

1- install mod_env

yum install ea-apache24-mod_env -y

2- create a .htaccess at the root of the folder that you want to put limit on ( public_html )

cat /home/user/public_html/vip/.htaccess

<IfModule ratelimit_module>
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 100
SetEnv rate-initial-burst 200
</IfModule>

in this way every connection will get something about ~10 mb/s

thanks for reading.

search terms :

mod_ratelimit

mod_bwlimited

mod_dialup

--

--