启用Apache2的SSI功能
我在当前版本中执行了与此相同的操作。
启用ssi。
确认 Apache2 的版本
$ apache2ctl -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2020-04-13T17:19:17
加载模块
sudo a2enmod include
設置檔案
<Directory /var/www/html/public_test>
Options +Includes +FollowSymLinks
AllowOverride none
Require all granted
AddType text/html .html
AddOutputFilter INCLUDES .html
</Directory>
确认设置是否正确
sudo apache2ctl configtest
Apache2 的重新启动
sudo systemctl restart apache2
我用来测试的HTML文件。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8" />
<title>ssi aaa
</title>
</head>
<body>
<p />
<h2>ssi のテスト</h2>
<!--#echo var="DATE_LOCAL" --><p />
<p />
Jul/28/2020 AM 06:00<br />
</body>
</html>
