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

Roger Smith nginx-forum at nginx.us
Mon Aug 29 21:18:13 UTC 2011


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: http://forum.nginx.org/read.php?2,214465,214465#msg-214465



More information about the nginx mailing list