Welcome! Log In Create A New Profile

Advanced

Cannot get auth_basic working

Posted by phil3361 
Cannot get auth_basic working
April 04, 2014 12:49PM
Hi all,

I am using nginx 1.5.12 on windows 7, and I cannot get basic authentication working...

Here is the situation:

- in nginx.conf:
[...]
location / {
root html;
index index.html index.htm;
auth_basic "ngvplatform";
auth_basic_user_file c:/nginx/conf/htpasswd;
}
[...]

- in c:/nginx/conf/htpasswd, nothing but these 2 lines:
phil:YAsIdyZPQf712
daniel:YAsIdyZPQf712

- I did get the encrypted password from the following command (is /this/ the point?):
C:\nginx>openssl passwd -crypt password
YAsIdyZPQf712

Then, the behavior on the web browser (Firefox 28 or IE10) is:

- the authentication window appears, asking for credentials for realm "ngvplatform". Fine :-)

- after entering "phil" as name and "password" as password (which should be legal) this window closes and opens again, asking for the same.

- same behavior if I enter "toto" as name and "password" as password (an unknown user).

- this repeats again and again... I cannot get logged in.

- in the error.log file, I can found many samples of the 2 following different lines:
2014/04/04 18:14:27 [error] 3256#5800: *3 user "phil": password mismatch, client: 172.16.25.211, server: wpmaurisset.eu.lectra.com, request: "GET / HTTP/1.1", host: "wpmaurisset.eu.lectra.com"
2014/04/04 18:15:03 [error] 3256#5800: *3 user "toto" was not found in "c:/nginx/conf/htpasswd", client: 172.16.25.211, server: wpmaurisset.eu.lectra.com, request: "GET / HTTP/1.1", host: "wpmaurisset.eu.lectra.com"

Could you please help me to find where I am wrong?
Thanks in advance,
Philippe.
Re: Cannot get auth_basic working
April 04, 2014 01:42PM
For generating passwords you need to use htpasswd.exe from apache.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: Cannot get auth_basic working
April 05, 2014 02:15AM
Thanks for your answer, I will try that way.

However, I did follow the documentation:
http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html#auth_basic_user_file

Philippe.
Re: Cannot get auth_basic working
April 05, 2014 03:00AM
I have additional information:

1 - These very same credentials...

> - in c:/nginx/conf/htpasswd, nothing but these 2 lines:
> phil:YAsIdyZPQf712
> daniel:YAsIdyZPQf712
>
> - I did get the encrypted password from the following command (is /this/ the point?):
> C:\nginx>openssl passwd -crypt password
> YAsIdyZPQf712

... do work well with nginx 1.4.2 on debian wheezy, but don't work on nginx 1.5.12 on windows 7

2 - The openssl password command on both OS generates the same encrypting - YAsIdyZPQf712 - with the same parameters (providing "YA" as salt).

Hope this helps,
Philippe.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 197
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready