Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache正在寻找不在';不在那里_Apache_.htaccess_Localhost_.htpasswd - Fatal编程技术网

Apache正在寻找不在';不在那里

Apache正在寻找不在';不在那里,apache,.htaccess,localhost,.htpasswd,Apache,.htaccess,Localhost,.htpasswd,Apache请求身份验证并根据不再位于DocumentRoot中的.htaccess文件中的说明查找.htpasswd文件时出现问题。背景: 在我的DocumentRoot中,我以前从另一台机器复制了一个.htaccess和.htpasswd文件(以及所有其他网站文件) .htaccess内容: AuthType Basic AuthName "Password is required" AuthUserFile /some/directory/that/was/on/the/other/ser

Apache请求身份验证并根据不再位于DocumentRoot中的.htaccess文件中的说明查找.htpasswd文件时出现问题。背景:

在我的DocumentRoot中,我以前从另一台机器复制了一个.htaccess和.htpasswd文件(以及所有其他网站文件)

.htaccess内容:

AuthType Basic
AuthName "Password is required"
AuthUserFile /some/directory/that/was/on/the/other/server/not/this/one/.htpasswd
Require valid-user
问题是:我将.htaccess和.htpasswd从DocumentRoot中移出,甚至重命名了这些文件。DocumentRoot中不再有.htaccess文件

但是,当我尝试从浏览器访问localhost时,系统会提示我输入登录名和密码

当我输入登录名和密码(来自旧的,而不是DocumentRoot.hpasswd文件)时,我得到一个500内部服务器错误,日志显示:

[error] [client 127.0.0.1] (2)No such file or directory: Could not open password file: /some/directory/that/was/on/the/other/server/not/this/one/.htpasswd
这是一个相当复杂的问题,因为DocumentRoot中不再有.htaccess或.htpasswd文件

已经尝试了多次apache重启,并且还尝试在DocumentRoot中使用空白的.htaccess文件。甚至在整个机器上搜索到
AuthType Basic
的引用,以查看是否遗漏了任何内容

httpd.conf看起来很正常……如果需要,我可以发布它,但这个问题看起来已经够长了:)


感谢您提供的任何帮助。不确定我怎么会错过它,但在DocumentRoot之上的一个目录级别上有一个.htpasswd和.htaccess文件。去掉这些,效果很好。不知道为什么这很重要,因为它不在DocumentRoot中,而是在它上面的一个级别……但是,这肯定是问题所在