# How to set a max access times within a limited time?

**URL:** <https://www.ruby-forum.com/t/how-to-set-a-max-access-times-within-a-limited-time/191480>\
**Category:** NGINX\
**Created:** [July 13, 2010, 11:16am UTC](https://www.ruby-forum.com/t/how-to-set-a-max-access-times-within-a-limited-time/191480 "2010-07-13T11:16:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [July 13, 2010, 11:16am UTC](https://www.ruby-forum.com/t/how-to-set-a-max-access-times-within-a-limited-time/191480/1 "2010-07-13T11:16:22Z")

</div>

I want to limit access to certain resources base on following rules:

1. each ip can only access the resources 333 times a day (or within  
the last 24 hrs)

2. no more than X simultaneous connections and no more than Xr/s

Currently, nginx can handle rule 2 with the limit zone module.  
[http://wiki.nginx.org/NginxHttpLimitZoneModule](http://wiki.nginx.org/NginxHttpLimitZoneModule)

location /resource {  
limit\_conn gullag 1;  
limit\_req zone=qincheng burst=1;  
}

How do I go about rule 1? Thank you!
