分类: 系统运维
2009-03-20 13:01:44
○SSI说明:SSI(Server Side Include),通常称为服务器端嵌入,是一种类似于ASP的基于服务器的网页制作技术。大多数(尤其是基于Unix平台)的WEB服务器如Netscape Enterprise Server等均支持SSI命令。主要有以下几种用用途:
1 显示服务器端环境变量<#echo>
2 将文本内容直接插入到文档中<#include>
3 显示WEB文档相关信息<#flastmod #fsize> (如文件制作日期/大小等)
4 直接执行服务器上的各种程序<#exec>(如CGI或其他可执行程序)
5 设置SSI信息显示格式<#config>(如文件制作日期/大小显示方式) 高级SSI
<注>以上内容来源:百度百科
○本应用要求:在html中插入当前时间及另外一段html文本。
○Apache的安装和配置:SSI的应用需要安装ApacheServer,并且安装完成后需要修改其配置文件(这里以version2.2为例进行说明,默认安装路径为C:\Program Files\Apache Software Foundation\)
1 httpd.conf文件更新
・文件位置:\Apache2.2\conf\httpd.conf
・更新内容1:
# First, we configure the "default" to be a very restrictive set of
# features.
#
Options FollowSymLinks →前加#改为注释
AllowOverride All
Order deny,allow →前加#改为注释
Deny from all →前加#改为注释
Xbithack full →改为"Xbithack ON"
Options Includes →改为"Options +Includes"
・更新内容2:
# The Options directive is both complicated and important. Please see
#
# for more information.
#
Options Indexes FollowSymLinks
Options FollowSymLinks MultiViews Includes →追加此行
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None →改为"AllowOverride All"
・更新内容3:
#
# "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
AllowOverride None →改为"AllowOverride All"
Options None
Order allow,deny
Allow from all
・更新内容4:
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddType text/x-server-parsed .html →追加此行
2 .htaccess文件做成
・文件位置:\Apache2.2
・文件内容:
Options +Includes
AddOutputFilter INCLUDES .shtml
AddHandler server-parsed html
AddType text/x-server-parsed-html .shtml .html .htm
・做成方法:由于windows不能作成只有文件后缀没有文件名的文件,所以可以先将上面的内容作成一个txt文件,如:htaccess.txt。然后进入cmd修改其文件名。重命名语句格式为:rename htaccess.txt .htaccess
・说明:由于本应用的要求是在html中插入文本,而不是在shtml中插入,所以.htaccess文件的配置是必不可少的。
3 重起Apache Server
○html做成
1 文件位置: \Apache2.2\htdocs
2 text.html