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

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

问题描述

我在 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.htmlhomepage.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" -->

我想我已经在 httpd.conf 中正确地打开了 SSI:

I think I have properly turned on the SSI in my 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 sever 11.10 和 apache2 上自己解决了这个问题.

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

我的/etc/apache2/sites-available/default 文件:

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>

我在/var/www 目录指令中将 AllowOverride None 更改为 All.

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

这会在 mods-available 中创建一个指向 include.load 的符号链接.

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

最后重启apache

sudo service apache2 restart

这对我有用,希望你也能用.

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

--托马斯

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

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