【发布时间】:2011-01-01 21:54:21
【问题描述】:
我正在尝试在 Ubuntu Jaunty 中使用 nginx 进行基本身份验证。在 nginx.conf 中,我在服务器上下文下添加了这两行:
server {
...
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
...
}
然后我 apt-get'ed apache2-utils 来获取我用来创建 htpasswd 文件的 htpasswd:
htpasswd -d -c /etc/nginx/.htpasswd joe
当我尝试访问该站点时,身份验证对话框按预期出现,但是当我输入用户名和密码时,它只是刷新了对话框。它似乎不喜欢我提供的密码。我尝试使用和不使用 -d 选项运行 htpasswd,但仍然没有运气。它拒绝进行身份验证。任何想法我做错了什么?
任何帮助将不胜感激。
【问题讨论】:
-
您尝试过“auth_basic_user_file”的相对路径吗?
-
@KP 你能分享为你解决这个问题的原因吗?
标签: nginx basic-authentication .htpasswd