Welcome! Log In Create A New Profile

Advanced

securing access to a folder - 404 error

March 10, 2013 04:07PM
I'm trying to secure a directory on a CentOS 6.3 64 server running NGINX 1.2.7. I think I've set this up correctly, but it keeps giving me a 404 Not Found error when I try to access a file in that folder in the browser using domainName/secure/hello2.html.

I created an .htpasswd file using printf "MYUSER:$(openssl passwd -1 MYPASSWORD)\n" >> .htpasswd
and put that into the /var/www/protected/ folder.

I also modified the NGINX config file and included a location/auth block for the /secure/ folder:

# protect the "secure" folder ( /var/www/html/secure )
location ^~ /secure/ {
auth_basic "Restricted";
auth_basic_user_file /var/www/protected/.htpasswd;
}

If I comment out this block from the config file and restart NGINX, I can see the file in the browser with no problem. I even moved the .htpasswd file into the /secure/ folder and changed the config file to reflect that change (just to see what would happen), but I still get the 404 Not Found error.

Can anyone tell me what I'm missing?
SubjectAuthorPosted

securing access to a folder - 404 error

mottwscMarch 10, 2013 04:07PM

Re: securing access to a folder - 404 error

Francis DalyMarch 18, 2013 05:52PM

Re: securing access to a folder - 404 error

mottwscMarch 18, 2013 08:10PM

Re: securing access to a folder - 404 error

Francis DalyMarch 19, 2013 05:12AM

SOLVED: securing access to a folder - 404 error

mottwscApril 04, 2013 08:54AM

Re: SOLVED: securing access to a folder - 404 error

ShohrehNovember 21, 2013 09:39AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 124
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready