【发布时间】:2014-10-02 08:27:38
【问题描述】:
目前我试图阻止通过.htaccess 和基本身份验证访问我的 apache2 网络服务器上的目录:
AuthType Basic
AuthName "Private"
AuthUserFile ?/.htpasswd
require valid-user
假设目录路径是/foo/bar,那么.htacccess 和.htpasswd 位于/foo/bar/.htaccess 和/foo/bar/.htpasswd 下。
来自/foo/bar/.htpasswd 的绝对寻址不起作用。我的用户帐户无权访问/。
我已经尝试从目录中相对解决它。但是apache2从apache2根目录解析相对地址,即/etc/apache2/。
实际上我只能编辑/foo/bar 中的内容。我也无法控制 apache2。
问题:在给定的限制下,如何处理AuthUserFile 的.htpasswd 文件?
【问题讨论】:
-
来自 /foo/bar/.htpasswd 的绝对寻址不起作用:你能澄清一下这是什么问题吗?
-
Apaches 错误日志指出,它无法访问该文件。就是这样。我很确定,那条路径是正确的,因为我检查了几次。
标签: .htaccess apache2 basic-authentication user-permissions .htpasswd