How to deny access to a folder, but allow access to every subfolders (wildcard)

carlg nginx-forum at nginx.us
Fri Jan 9 00:44:10 UTC 2015


Hi,

I need to deny access to /members but allow access to every folders below.

There may be a lot of folders, maybe a thousan, and each of those folders
contain 5 other folders.  So i need a wildcard.

Here is what i tried : 

location ~ ^/members/([^/]+)/([^/?]+)$ { allow all; }            #allow
every folders below /members with wildcard
location ~ ^/members/ { deny all; }                                    #deny
everything else

But it doesn't work.

What am i missing exactly?

Thank you,

Carl

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256008,256008#msg-256008



More information about the nginx mailing list