我在 Windows Server 2008 R2 中运行 Apache 2.4。我正在尝试对子目录进行密码保护,并在 Apache 2.0 中成功地做到了这一点。升级后,我接受了 Apache 的建议,并尝试将身份验证配置放在 httpd.config 中。我允许读取密码文件,一切似乎都井井有条,但是当我测试它时,我收到以下错误:
[Mon Apr 01 19:58:36.438476 2013] [auth_basic:error] [pid 3984:tid 788] [client xxx.yyy.254.2:49253] AH01617:用户主:“/restricted/file.zip”的身份验证失败:密码不符合
但是,我知道我正在发送正确的密码。请参阅下面的配置,任何评论都会有所帮助。
<Directory "C:/www/mydir/restricted">
#AllowOverride AuthConfig
#Order allow,deny
#Allow from all
AuthType Basic
AuthName Restricted
AuthUserFile "C:/www/mydir/passwords/pass"
Require valid-user
</Directory>
<Directory "C:/www/mydir">
Require all granted
</Directory>
<VirtualHost *:80>
ServerAdmin admin@.com
DocumentRoot "C:/www/mydir"
ServerName "fakeurl.com"
ErrorLog "C:/www/mydir/logs/error.log"
CustomLog "C:/www/mydir/logs/accesslog/access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@.com
DocumentRoot "C:/www/mydir"
ServerName "www.fakeurl.com"
ErrorLog "C:/www/mydir/logs/error.log"
CustomLog "C:/www/mydir/logs/accesslog/access.log" common
</VirtualHost>