Limiting user access to static files

Igor Sysoev is at
Wed Jan 9 14:01:44 MSK 2008

On Wed, Jan 09, 2008 at 02:07:17AM +0100, Blasfamous As usual wrote:

> I am looking forward to use nginx for serving my static contents. I want
> to limit the number of accesses to any static file (# of open file
> handles to these files) to 1 so that only 1 access is allowed at a time
> per file. Is there a way to handle this in nginx?

You may try

    http {
        limit_zone   uri  $uri  10m;


        server {


            location /static/ {
                limit_conn   uri  1;

However, now limit_zone has limit of 255 length variable value, so
you can not use for URIs longer than 255.

I will probaly fix it after my vacation.

Igor Sysoev

More information about the nginx mailing list