How does 'locate' work?

Edho P Arief edhoprima at
Thu Oct 22 08:31:37 MSD 2009

On Thu, Oct 22, 2009 at 3:50 AM, GAZ082 <nginx-forum at> wrote:
> Hi! I want to protect a directory and its content. The directory is located in the server in the dir:
> /var/www/
> So, i have:
if you're using latest development version, try specifying the
location without trailing slash

-    location /public/documents/ {
+    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

O< ascii ribbon campaign - stop html mail -

More information about the nginx mailing list