Security 阿帕奇禁区

Security 阿帕奇禁区,security,apache2,Security,Apache2,我一直在测试apache身份验证的使用情况,如下所示 我正在使用Ubuntu/Apache2 在我的“站点”中,/etc/apache2/sites enabled/playcat,指向/home/playcat/public_html,我输入了以下内容: <Directory "/home/playcat/public_html/backend"> AuthType Basic AuthName "Restricted Content" AuthBasicP

我一直在测试apache身份验证的使用情况,如下所示

我正在使用Ubuntu/Apache2

在我的“站点”中,/etc/apache2/sites enabled/playcat,指向/home/playcat/public_html,我输入了以下内容:

<Directory "/home/playcat/public_html/backend">
    AuthType Basic
    AuthName "Restricted Content"
    AuthBasicProvider file
    AuthUserFile /home/playcat/passwd/passwords
    Require user playcat
</Directory>
显然,在此之前我创建了passwd文件夹:

现在,当我打开时,我得到了u/p组合的提示。然而,当我输入它时,我得到403响应

除此之外,服务器工作正常。我安装了php和mysql,一切正常

我错过smt了吗

Thx

p、 我正在使用正确的用户/通行证组合:

尝试更改

<Directory "/home/playcat/public_html/backend"> 

这就是根据规范编写的方式:

下面是一个适合我的例子:

  <Directory /path/to/web/site/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All

    Order deny,allow
    AuthType Basic
    AuthName "Restricted Files"
    # (Following line optional)
    AuthBasicProvider file
    AuthUserFile /path/to/htpasswd
    Require valid-user
  </Directory>

谢谢,这就成功了。另外,我忘了为blush文件夹设置755
<Directory /home/playcat/public_html/backend>
  <Directory /path/to/web/site/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All

    Order deny,allow
    AuthType Basic
    AuthName "Restricted Files"
    # (Following line optional)
    AuthBasicProvider file
    AuthUserFile /path/to/htpasswd
    Require valid-user
  </Directory>