我在Ubuntu 12.04服务器上运行Apache(2.2.22版)Web服务器。 SSI不起作用。 index.shtml页面中的经典<!--#echo var="DATE_LOCAL" -->不会被解释。在/etc/apache2/httpd.conf中,我输入了:

Options +Includes
AddType text/html .shtml
AddHandler server-parsed .shtml
AddOutputFilter INCLUDES .shtml

并在/etc/apache2/sites-available/default中:
    DocumentRoot /var/www
    <Directory />
            Options Indexes FollowSymLinks MultiViews +ExecCGI +Includes
            AllowOverride All
            AddHandler cgi-script .cgi .pl .py
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    <IfModule mod_dir.c>
         DirectoryIndex index.shtml index.html index.php
    </IfModule>

此外,error.log给我:
[Wed May 07 13:51:23 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.11 with Suhosin-Patch configured -- resuming normal operations
[Wed May 07 13:51:26 2014] [error] an unknown filter was not added: includes
[Wed May 07 13:51:27 2014] [error] an unknown filter was not added: includes

在此先感谢您的帮助:)

最佳答案

我发现了问题:我只需要加载include模块。实际上,我只需要a2enmod include即可解决问题。

很抱歉这个愚蠢的问题。我把它留给像我这样一整天都在寻找这样明显的东西的人...

关于linux - Apache SSI无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23517165/

10-11 07:16