atomx / nginx-http-auth-digest

Digest Authentication for Nginx
Other
44 stars 14 forks source link

error after successfully authenticate, any problem with realm? #20

Closed Wilson-G closed 5 years ago

Wilson-G commented 5 years ago

After successfully authenticate, is shows following words of my website:

An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

I created passwd.digest with htdigest command like this:

htdigest -c pth 'oops' usrname

and I wrote these lines in nginx.conf:

location / {
            auth_digest 'oops';
            root   /my_apps;
            index  index.html index.htm;
        }       

I don't know what's wrong with all my operation, but guess it may related to the realm ,do you have any experience of this error?

Thanks a lot!

erikdubbelboer commented 5 years ago

Did you also configure auth_digest_user_file?

Wilson-G commented 5 years ago

Did you also configure auth_digest_user_file?

sure, otherwise I can't successfully authenticate

Wilson-G commented 5 years ago

I mean I add

auth_digest_user_file /pth

to the server block

erikdubbelboer commented 5 years ago

Is there anything in your server logs? If you remove the auth_digest line does everything work fine?

Wilson-G commented 5 years ago

yes, when I remove everthing works, and I will check logs, thanks for replying

On 07/27/2019 00:07, Erik Dubbelboer wrote:

Is there anything in your server logs? If you remove the auth_digest line does everything work fine?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Wilson-G commented 5 years ago

hello, I finally get this problem done! I just change the path of auth_digest_user_file from /root to /usr/local/nginx/conf, and it suddenly works!

I thought it may related to the authority of the folder.

btw, may be it will be better if you hint this guideline in README that realm of .digest file and realm of auth_digest in nginx.conf must be the same, I tried a lot of times in this question.

erikdubbelboer commented 5 years ago

It says do right in the readme with the auth_digest directive: The realm name should correspond to a realm used in the user file.

I have added a note about the auth_digest_user_file needing to be readable by your nginx user.

Thanks for letting us know how you fixed this.