【发布时间】:2013-10-05 17:18:58
【问题描述】:
Web 服务器是在 Ubuntu 12.04 LTS 上运行的 Apache 2.2.22。
这是我的 http.conf 文件:
DirectoryIndex index.shtml index.html index.cgi index.pl index.php index.xhtml
LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
AddHandler cgi-script .cgi .pl
LoadModule include_module /usr/lib/apache2/modules/mod_include.so
<Directory "/var/www">
Options +Includes
AddHandler server-parsed .shtml
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
XBitHack on
</Directory>
根据http://httpd.apache.org/docs/current/mod/mod_include.html,我需要有 AddType 条目(知道了)、AddOutputFilter 项(知道了)和 Options +Includes 项(知道了)。它说我需要把它放在一个部分(明白了)。
根据http://httpd.apache.org/docs/current/howto/ssi.html,我需要 Options +Includes(知道)、AddType(知道)、AddOutputFilter(知道)和 XBitHack On 可能会有所帮助。
这是 /var/www/index.shtml 文件:
<html>
<body>
<p>The current date is <!--#echo var="DATE_LOCAL" --></p>
</body>
</html>
该文件的权限设置为 -rwxr-xr-x。
当我在我的网络浏览器中加载文件时,它可以正常加载和渲染,但 SSI 部分没有得到处理。我只看到“当前日期是”。
这是来自 /var/log/apache2/access.log 的条目:
10.0.2.2 - - [05/Oct/2013:16:57:07 +0000] "GET /index.shtml HTTP/1.1" 200 401 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.66 Safari/537.36"
这是来自 /var/log/apache2/error.log 的错误:
[Sat Oct 05 16:57:07 2013] [warn] [client 10.0.2.2] mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed
选项+包含没有设置?我在我的 http.conf 文件中看到了它。我用 Google 搜索了一下,但无法弄清楚问题所在。
【问题讨论】:
-
看起来解决方案在这里:aboutlinux.info/2006/02/…。等我有时间尝试后,我会发布一个解决方案。