How to Limit Download Speed Per IP on NginX

How to Limit Download Speed Per IP on NginX

Learn to Limit Download Speed Per IP on NginX easily. You can now throttle Speed / Bandwidth on IP Level in Nginx regardless number of connections/requests.

Limit Download Speed Per IP on NginX – Overview

Previously our dedicated servers were on Apache. We had CBand module on Apache which was able to limit users’ download speed on the IP level. But after Migration to NginX web server, we were in search of an alternative of CBand for Nginx. Initially, we couldn’t find a way to throttle speed on an IP basis. Because the nginx default Limit rate couldn’t serve the purpose. it only had two options. Either we could limit connections that an IP makes. Or we could limit each connection speed.

image

We know today download manager makes a lot of connections while downloading a file. So even if we restrict the number of connections that would impact user’s downloads. So we had to find a way to limit the overall download speed of files from Nginx regardless on number of connections. Our issues were solved once we came to a Nginx module written By Simon Lee on GitHub which could easily do this magic.