Flintyk
Flintyk

Reputation: 33

Nginx basic_auth

I have settings:

location / {auth_basic "Private zone";auth_basic_user_file /user/.httpasswds;}

and

location index.html {auth_basic off;}

www.myserver.org/index.html works perfect without basic auth dialog,

Index file is index.html, but www.myserver.org or www.myserver.org/ asks password.

How to solve it? Thank you.

Upvotes: 2

Views: 265

Answers (1)

Richard Smith
Richard Smith

Reputation: 49822

You need to accept connections for / and /index.html without authentication.

index index.html;

location = / { }

location = /index.html { }

location / {
    auth_basic "Private zone";
    auth_basic_user_file /user/.httpasswds;
}

See this document for details.

Upvotes: 3

Related Questions