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>
Run Code Online (Sandbox Code Playgroud)
根据这个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>
Run Code Online (Sandbox Code Playgroud)
该文件的权限设置为-rwxr-xr-x.
当我在我的Web浏览器中加载文件时,它会加载并呈现正常但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; …Run Code Online (Sandbox Code Playgroud)