apache 尝试访问 lost+found 目录中的 .htaccess

apache 尝试访问 lost+found 目录中的 .htaccess

apache(ubuntu 12.04 上的版本 2.2.22)vhost webroot 的子目录/var/www/vhost/servername/httpdocs/subdir/是其自己的磁盘分区。因此,还有/var/www/vhost/servername/httpdocs/subdir/lost+found。在我的 apache 错误日志中,我发现无法读取的错误/var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess,引用者如下/var/www/vhost/servername/httpdocs/subdir/foo/(即当FancyIndexing向用户显示该目录的目录索引时)。

[2014 年 11 月 28 日星期五 09:14:19] [crit] [客户端 10.0.0.1] (13)权限被拒绝:/var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess pcfg_openfile:无法检查 htaccess 文件,请确保其可读,引用者:http://servername/subdir/foo/

我无法理解这一点。为什么 Apache 会尝试读取

  • /var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess

那个时候?在我看来,它应该只有理由尝试阅读

  • /var/www/vhost/servername/httpdocs/subdir/foo/.htaccess
  • /var/www/vhost/servername/httpdocs/subdir/.htaccess
  • /var/www/vhost/servername/httpdocs/.htaccess

有趣的是,更深的子目录(例如http://servername/subdir/foo/bar/baz/)没有出现相应的错误消息。

是什么原因导致了此错误(或首先导致读取尝试)?我该如何摆脱它?

答案1

.htaccessApache 会尝试在每个目录中查找文件,但lost+found通常只有可读的root,因此它甚至无法检查文件是否存在。

一种解决方案是将磁盘挂载到其他地方,将数据移动到该挂载点的子目录中,然后通过符号链接或绑定挂载将该子目录放到位。这样,lost+found就不会出现在 Apache 搜索的目录树中。

相关内容