服务器端包括

发布于 2024-12-05 08:06:15 字数 689 浏览 11 评论 0原文

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

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 都位于文档根目录中):

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

我认为我已在 httpd.conf 中正确打开 SSI:

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

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

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" -->

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笔芯 2024-12-12 08:06:15

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

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

<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 。

我的 .htaccess 文件位于 /var/www/.htaccess 中:

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

最后我确保 include.load 位于 mods-enabled 文件夹中,这是为了加载 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

这使它对我有用,希望你也能让它工作。

--
托马斯

I just fixed this problem myself on ubuntu sever 11.10 with 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>

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

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

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

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

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

finally restart apache

sudo service apache2 restart

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

--
Thomas

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文