用Apache密码保护目录:“无法检查用户。 检查你的authn提供者!“

我正在尝试密码保护与Apache的Web目录。 我有这样的网站设置:

D:/ webapp/ lib/ .htpasswd document_root/ admin/ index.php .htaccess 

.htaccess有:

 AuthName "Authorization Required" AuthType Basic AuthUserFile D:\webapp\lib\.htpasswd require valid-user 

而且.htpasswd有:

 user:passworddigest 

当我尝试在浏览器中访问localhost/index.php ,出现500错误。 Apache的错误日志有这样的:

 ["date"] [crit] [client "ip"] configuration error: couldn't check user. Check your authn provider!: /admin/ 

我GOOGLE了,但我无法弄清楚这个错误在我的服务器上下文意味着什么。 任何人都知道这是怎么回事 此外,它会解决我的问题,如果有人有一个简单的方法使用Apache的身份validation在Windows服务器上的Web目录。

如果这不是像上面提到的Jim B这样的权限问题(我也怀疑这个),你可能没有在Apache-mod_authn中加载authn模块。 我不知道如何在Windows中做到这一点,但我很确定,如果你在谷歌周围,你会发现它是如何做到的。

我认为你的.htaccess中的.htpasswdAuthType Basic )是错误的,看着你的.htpasswd它告诉我,密码是由htdigest &not htpasswd设置的(纠正我,如果我错了),因此configuration错误。

要解决此问题,请尝试以下.htaccess信息和问题应该消失:

 AuthName "Authorization Required" AuthType Digest AuthUserFile D:\webapp\lib\.htpasswd require valid-user 

但是我build议你使用上面的方法,因为password is transmitted in in the network whereas password is transmitted in MD5摘要password is transmitted in in the network whereas AuthType Basic`则是以干净的文本传输密码。

但是,如果你坚持要有AuthType Basic那么请尝试下面的.htaccess

 AuthName "Authorization Required" AuthType Basic AuthUserFile D:\webapp\lib\.htpasswd require valid-user 

从以下链接创buildhtpassword:

http://www.htaccesstools.com/htpasswd-generator/

并更新您的.htpasswd文件。

我没有在Windows上完成这个工作,但是如果它被注释掉的话,可以通过取消注释中的这一行来尝试启用你的httpd.conf文件中的auth_digest模块。 我知道这是默认禁用的:

 LoadModule auth_digest_module modules/mod_auth_digest.so