2011-09-18 106 views
0

我在Apache日志中的以下错误信息:服务器端包含

unable to include potential exec "header.html" in parsed file /Users/sikusiku/Sites/ss-git/homepage.shtml 

我基本上是试图包括了header.htmlhomepage.shtml。我用了很基本的指令在homepage.html(包括了header.htmlhomepage.shtml位于文档根目录):

<!--#include virtual="header.html" --> 

我想我已经正确地打开了SSI的我的httpd.conf

Options Indexes FollowSymLinks ExecCGI Includes 
... 
AddType text/html .shtml 
... 
# XBitHack doesn't have anything to do with this, but I added it anyway. 
XBitHack on 

我错过了什么?包含的文件,即header.html是否需要配置不同?

+1

你不需要XBitHack当你指定的文件SHTML。如果header.html与shtml在同一目录中,只需执行<! - #include file =“header.html” - > –

+0

尝试virtual =“/ header.html”。除此以外;该错误似乎意味着一些权限错误。尝试chmod header.html不可执行。 – Gerben

+0

不幸的是,这两个建议没有奏效。 – moey

回答

0

我刚刚在ubuntu sever 11.10上用apache2修复了这个问题。

我的/ etc/apache2的/网站可用/默认文件:

<VirtualHost *:80> 
    ServerAdmin [email protected] 

    DocumentRoot /var/www 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride All 
      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> 

    ErrorLog ${APACHE_LOG_DIR}/error.log 

    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 

    CustomLog ${APACHE_LOG_DIR}/access.log combined 

Alias /doc/ "/usr/share/doc/" 
<Directory "/usr/share/doc/"> 
    Options Indexes MultiViews FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.0/255.0.0.0 ::1/128 
</Directory> 

</VirtualHost> 

我在/ var/www目录指令改变了AllowOverride无所有。在/var/www/.htaccess

我的.htaccess文件:

Options +Includes 
AddType text/html .shtml 
AddOutputFilter INCLUDES .shtml 

我终于确信,include.load在启用MODS的文件夹,这是加载mod_includes.so模块。

sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled/include.load 

这会创建一个符号链接到mods-available中的include.load。

终于重新启动Apache

sudo service apache2 restart 

这使得它为我工作,希望你得到它的工作为好。

- 托马斯

+0

注意:ubuntu/debian apache2具有不同的配置模式,然后股票apache2。这可以在如何配置东西方面产生很大的差异,请参阅:http://www.control-escape.com/web/configuring-apache2-debian.html –