如何获得服务器端包含以在Centros 7上安装的Apache上工作?

问题描述 投票:0回答:2

我让ssi在InMotionHosting上工作,但无法在本地Centros 7安装上使其工作。Apache版本2.4.6

httpd -M显示已加载so_module,但未加载mod_include。

[当我尝试添加mod_include时,出现错误:httpd: Syntax error on line 55 of /etc/httpd/conf/httpd.conf: Can't locate API module structuremod_include'在/etc/httpd/modules/mod_include.so文件中:/etc/httpd/modules/mod_include.so:未定义符号:mod_include'

我试图修改httpd.conf文件:

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    Options +Includes
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml

仍然SSI失败。

索引文件很简单:

<h1>Test page</h1>
/var/www/index.html
<br/>
<!--#echo var="DATE_LOCAL" -->
<!--#include virtual="./insert.shtml" -->

我想念什么?

apache centos7 ssi
2个回答
0
投票

通过设置XBitHack使ssi在Centros 8上工作。

httpd.conf:

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Options +Includes
    # AddType text/html .shtml
    # AddHandler server-parsed .shtml
    XBitHack on
     Require all granted
</Directory>

并且在/ var / www / html中执行:

chmod +x test.shml

index.htm:

现在可以使用.shtml文件。

服务器版本:Apache / 2.4.37(centos)


0
投票

经过几次失败后,我发现它可以正常工作:

AddType文本/ html .shtml

AddHandler服务器解析的.html

我发现的所有示例都显示了AddHandler服务器解析的.shtml。我的主文件是index.html,而ssi文件是test.shtml。

希望这对某人有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.