# Limiting connections / max download amount - how can nginx help?

**URL:** <https://www.ruby-forum.com/t/limiting-connections-max-download-amount-how-can-nginx-help/211223>\
**Category:** NGINX\
**Created:** [August 29, 2011, 11:19pm UTC](https://www.ruby-forum.com/t/limiting-connections-max-download-amount-how-can-nginx-help/211223 "2011-08-29T23:19:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [August 29, 2011, 11:19pm UTC](https://www.ruby-forum.com/t/limiting-connections-max-download-amount-how-can-nginx-help/211223/1 "2011-08-29T23:19:04Z")

</div>

Hi, I’m loving how flexible Nginx is, and how much is built into a  
simple default build. Thanks to everyone involved. I’m at the point now  
though where I need to be able to limit connections to a site on a per  
user basis. I have a site which is behind basic auth, and users pay for  
a username / password combination. I wish to stop cheaters from sharing  
their username / password combinations with others around the world, and  
to prevent bandwidth hammering.

This makes me think of a few problems:

limit connection rate: the limit request module is a bit heavy handed. I  
have pages that are media heavy and can have 100+ images on. I’m unable  
to open another page without it blocking me when opening a page with  
this many media. I wish it would prioritise pages over static content.  
Of course, this is with one zone set up, and a limit\_req in the server  
context. Should I set up another zone, one for static content, and one  
for pages so they’re counted separately?

limit daily download amout: Can Nginx do this? I’ve looked down the  
modules and custom modules but didn’t see anything. Something that could  
limit the user to download x gb/mb p/day. If the limit were 500mb and I  
had downloaded 480mb and then tried to dl a 60mb file, I’d expect to not  
be able to download the new file. Any ideas on this?

Username/password sharing. I’m at a complete loss on this. It’d need to  
be smart enough to catch users from around the world; same country,  
different cities etc, and also be flexible enough to allow different  
devices to connect of the same user. Any ideas would be great.

Thank you

Posted at Nginx Forum:

> **[Limiting connections / max download amount - how can nginx help?](https://forum.nginx.org/read.php?2,214465,214465#msg-214465)**
>
> Hi, I'm loving how flexible Nginx is, and how much is built into a simple default build. Thanks to everyone involved. I'm at the point now though where I need to be able to limit connections to a site on a per user basis. I have a site which is...
