Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It's possible to restrict the speed using the rate limit on a specific location.

However, how can we do it dynamically ?

Let say you have paid vs non-paid users and you want to give an higher bandwidth to paid users.

We would need to dynamically check in the Database and allow a certain speed for this particular group of users.

Do you have any nginx module in mind ?

share|improve this question

Yes, you can rate limit on a specific location.

location /something/ { 
    set $limit_rate  4k; 

You can also surround the limite_rate with statements like if as well to dynamically control the rates. See this link for further details on limite rate:

There is another module you should be mindful of:

That module allows you to set limits of connection count. So, even if you set a low limit, if they can just make 10 connections, your limit is rather meaningless.

I suggest you have private and public users get different links so that nginx can easily distinguish between the types of users and verify in your application layer for security.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.