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

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

当它不起作用,就好像Apache已经决定index.html文件不存在一样,所以试图服务一个目录列表,但是这是故意被我们的configuration拒绝。

Apache虚拟主机特定的错误日志包含如下条目:

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

Apache通用错误日志不包含任何内容

Apache虚拟主机特定访问日志包含如下条目:

 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 

Apacheconfiguration看起来像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,并给你更奇怪的结果。

是否有更低级别的重写?

你包括的日志行是一个手机浏览器。 你有其他处理移动networking浏览器的Apache处理吗? 你是否正在进行与HTTP_USER_AGENT相匹配的重写,并在其他地方发送请求?

看起来你可能只需要在你的目录声明特别/ main /目录下添加“Indexes”选项。