加入收藏 | 设为首页 | 会员中心 | 我要投稿 拼字网 - 核心网 (https://www.hexinwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux – Apache Web服务器间歇性地服务403:“Options指令禁止

发布时间:2021-03-05 20:16:22 所属栏目:Linux 来源:网络整理
导读:我们在CentOS 5.5 Linux上的Apache / 2.2.19上为.html文件配置了一个带SSI的网站.工作正常,但偶尔会获得403的根页面(index.html作为目录索引).页面工作时没有文件系统更改,不起作用然后再次工作. 当它不起作用时,就好像Apache已经确定index.html文件不存在所

我们在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上做任何匹配的重写并在其他地方发送请求吗?

(编辑:拼字网 - 核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!