Anyway to limit amount of requests to no more then 20 requests per hour for each file?

Hello,

Iam trying to avoid a seperate location {} for each file, instead just
limit the amount of reqeusts per second based on each object.

Iam sure there must be a way.

Thanks

Joseph

On Wednesday 06 June 2012 00:30:26 Joseph C. wrote:

Hello,

Iam trying to avoid a seperate location {} for each file, instead just
limit the amount of reqeusts per second based on each object.

If you’re happy with 60 requests per hour, then you can take advantage
of
the http_limit_req module.

http://nginx.org/en/docs/http/ngx_http_limit_req_module.html

limit_req_zone $uri zone=one:32m rate=1r/m;

wbr, Valentin V. Bartenev

Great…

So all I need is that single line in the httpd section, or server
section?

limit_req_zone $uri zone=one:32m rate=1r/m;

Iam thinking I need some other line to actually apply the limit such as
this?

location / { limit_req zone=one; proxy_pass http://backend1; }

Or something like this?

Joseph

On Wednesday 06 June 2012 02:18:46 Joseph C. wrote:
[…]

Iam thinking I need some other line to actually apply the limit such as
this?

location / { limit_req zone=one; proxy_pass http://backend1; }

Or something like this?

Yes, that’s right. You also need limit_req directive in the place where
do you
want to apply the limit.

wbr, Valentin V. Bartenev