How does 'locate' work?

GAZ082 nginx-forum at
Thu Oct 22 00:50:38 MSD 2009

Hi! I want to protect a directory and its content. The directory is located in the server in the dir:


So, i have:

    location /public/documents/ {
        root /var/www/;
        auth_basic            "Access restricted.";
        auth_basic_user_file   /private/pass;

The thing is, i've been toying with the location and root options, with and without ^ and seems that i can not frigging protect the directory. So, can someone explain me with practical examples, how does the location and root parameters work? I read the wiki and can't get it to work properly.

Thanks a LOT!

Posted at Nginx Forum:,15688,15688#msg-15688

More information about the nginx mailing list