服务器端包含 [英] Server Side Includes

查看:172
本文介绍了服务器端包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Apache日志中的以下错误消息:

I got the following error message in the Apache log:

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

我基本上是试图从的 homepage.shtml 的包含的了header.html 的。我使用了非常基本的指令的 homepage.html 的(均 header.html中的和的 homepage.shtml的位于文档根目录):

I basically tried to include header.html from homepage.shtml. I used the very basic directive in homepage.html (both header.html and homepage.shtml are located in the document root):

<!--#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 的需要进行不同的配置?

Did I miss anything? Does the included file i.e. header.html need to be configured differently?

推荐答案

我刚刚解决了这个问题,我在Ubuntu的Apache2与11.10断绝

I just fixed this problem myself on ubuntu sever 11.10 with apache2.

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

my /etc/apache2/sites-available/default file:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    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>

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

I changed AllowOverride None to All in /var/www directory directive.

在/var/www/.htaccess我的.htaccess文件:

my .htaccess file in /var/www/.htaccess:

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

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

finally i made sure that include.load was in the mods-enabled folder this is to load the mod_includes.so module.

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

这将创建一个符号链接include.load MODS可用。

That creates a symbolic link to the include.load in mods-available.

终于重新启动Apache

finally restart apache

sudo service apache2 restart

这使得它为我工作,希望你得到它的工作也是如此。

That made it work for me, hope you get it working as well.

-
托马斯

-- Thomas

这篇关于服务器端包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆