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

一个apache的子目录/var/www/vhost/servername/httpdocs/subdir/ (在Ubuntu 12.04版本2.2.22)vhost webroot是它自己的一个磁盘分区。 相应的,还有/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目录索引被显示给用户时)。

[Fri Nov 28 09:14:19 2014] [crit] [client 10.0.0.1](13)Permission denied:/var/www/vhost/servername/httpdocs/subdir/lost+found/.htaccess pcfg_openfile:无法检查htaccess文件,确保它是可读的,referer: 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/ )不会出现相应的错误消息。

是什么原因导致这个错误(或者是读取尝试的原因)? 我怎样才能摆脱它?

Apache会尝试在每个目录中find.htaccess文件,但是lost+found的文件通常只能被root读取,所以甚至不能检查文件是否存在。

一种解决方法是将磁盘安装到其他位置,将数据移动到该安装点的子目录中,然后将符号链接或绑定到该子目录中。 这样, lost+found不在Apachesearch的目录树中。