Problem with auth_basic and auth_basic_user_file

Hallo,

I want a login for this location.

location /TEST/ {
   alias /www/c2c/;
   }

With

location /TEST/ {
alias /www/c2c/;
auth_basic “Test Auth”;
}

no username/password box in the browser. I see the index.html site from
the
c2c folder

With

location /TEST/ {
   alias /www/c2c/;
   auth_basic "Test Auth";
   auth_basic_user_file /nginx/conf/htpasswd;
   }

and an “404 Not Found” error shows the browser.

I use nginx 1.7.2

Where is the problem?

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

Hello!

On Mon, Jun 23, 2014 at 03:26:14PM -0400, Varix wrote:

location /TEST/ {
alias /www/c2c/;
auth_basic “Test Auth”;
}

no username/password box in the browser. I see the index.html site from the
c2c folder

This is expected. Both auth_basic and auth_basic_user_file must
be set for auth_basic to work.

With

location /TEST/ {
   alias /www/c2c/;
   auth_basic "Test Auth";
   auth_basic_user_file /nginx/conf/htpasswd;
   }

and an “404 Not Found” error shows the browser.

This likely indicate you have some error_page’s configured, and
they intercept “401 Unauthorized” returned. Try looking into your
configs and into error log.


Maxim D.
http://nginx.org/

Hallo Maxim,

thanks. I copy some errorpages in the custom errorpage folder and all is
OK.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs