Problem with auth_basic and auth_basic_user_file

Maxim Dounin mdounin at mdounin.ru
Tue Jun 24 02:36:00 UTC 2014


Hello!

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

> 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

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 Dounin
http://nginx.org/



More information about the nginx mailing list