微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – Apache Web服务器间歇性地服务403:“Options指令禁止的目录索引”和304

我们在CentOS 5.5 Linux上的Apache / 2.2.19上为.html文件配置了一个带SSI的网站.工作正常,但偶尔会获得403的根页面(index.html作为目录索引).页面工作时没有文件系统更改,不起作用然后再次工作.

当它不起作用时,就好像Apache已经确定index.html文件不存在所以尝试提供目录列表,但我们的配置故意拒绝这样做.

Apache virtualhost特定错误日志包含以下条目:

[Tue Aug 09 03:10:47 2011] [error] [client 66.249.72.3] Directory index forbidden by Options directive: /main/directory/

Apache一般错误日志不包含任何内容

Apache virtualhost特定访问日志包含以下条目:

66.249.72.3 - - [09/Aug/2011:03:10:47 +0100] "GET / HTTP/1.1" 403 230 "-" "SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)"

总体分布:

# fgrep 'GET / ' `ls -tr domain-access_log*` | cut -d ' ' -f 9 | sort | uniq -c
   1339 200
      1 206
     31 304
     29 403

Apache配置看起来像lke:

<VirtualHost ip.address:80>
  ServerName domain.here

  DocumentRoot /main/directory
  ErrorLog logs/domain-error_log
  CustomLog logs/domain-access_log combined
  DirectoryIndex index.html

  AliasMatch ^/(robots\.txt|sitemap.*\.xml(?:\.gz)?)$/other/directory/$1

  CacheEnable disk /
  Cachedisable /sitemap.xml.gz
  Cachedisable /robots.txt
  CacheIgnoreHeaders Set-Cookie
  CacheIgnoreNoLastMod On

  AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript

  <Directory /main/directory>
    Options Includes
    AddOutputFilter INCLUDES .html
    Order allow,deny
    Allow from all
  </Directory>

  <Directory /other/directory>
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

解决方法

由于这是一个虚拟站点,我们还必须考虑httpd.conf级别的设置…您是否在任何地方设置了选项多视图? SSI加语言协商可能导致它尝试提供不存在的index.html备用版本.然后同样的事情可能导致它无法找到它想要的ErrorDocument并给你更奇怪的结果.

是否有较低级别的重写?

旧您包含的日志行是手机浏览器.您是否有处理移动Web浏览器的其他Apache处理?你在HTTP_USER_AGENT上做任何匹配的重写并在其他地方发送请求吗?

原文地址:https://www.jb51.cc/linux/397789.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐