在Ubuntu中配置Apache2 的SSI功能
第一步:如果您的Ubuntu中还未安装APACHE服务器,请先安装
sudo apt-get install apache2
第二步:创建符号链接.
sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled
第三步:打开/etc/apache2/sites-available/default文件,并加入以下代码.
sudo gedit /etc/apache2/sites-available/default
...
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# Commented out for Ubuntu
#RedirectMatch ^/$ /apache2-default/
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</Directory>
...
第四步:重启Apache 并且创建一个SSI测试文件(linuxidc.shtml)
然后保存到Apache的网站根目录。例如: /var/www/.
<html>
<head>
<title>SSI Test Page</title>
</head>
<body>
<!--#echo var="DATE_LOCAL" -->
</body>
</html>
第五步:测试SSI网页.
http://localhost/linuxidc.shtml
如果你能够看到你的SHTML网页,那说明你的配置成功了!恭喜你!!