use*_*179 7 apache authentication .htaccess .htpasswd
我在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>
Run Code Online (Sandbox Code Playgroud)
小智 14
你用'htpasswd'创建了密码吗?
httpd-2.4.4中的htpasswd被破坏了(https://issues.apache.org/bugzilla/show_bug.cgi?id=54735).
据我了解,问题是httpd-2.4.4中的htpasswd特有的,只有在您手动输入密码时才会出现,因此您可以通过执行以下操作之一来解决此问题: