- 时间:2020-05-08 05:50 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:让Apache支持cgi、SSI、shtml的配置方法
1.首先明确,只能够指定某个确定的目录,支持cgi,即运行该目录执行cgi程序;否则不太安全。
寻找:
[url=http://www.1sucai.cn/tools/onlinetools/apache-chs/howto/ssi.html]http://www.1sucai.cn/tools/onlinetools/apache-chs/howto/ssi.html[/url]
3. 一个使用SSI的shtml页面实例:
1)、index.shtml
<html>
<head>
<title>shtml</title>
</head>
<body>
<!--#config timefmt="%D" -->
This file last modified <!--#echo var="LAST_MODIFIED" --><br />
<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" --><br />
<!--#include virtual="embed.html" --><br />
<!--#exec cmd="test.pl" --><br />
<!--#exec cmd="dir" --><br />
</body>
</html>
2)、embed.html
<html>
<head>
<title>embed html</title>
</head>
<body>
This is the content from embed.html
</body>
</html>
3)、test.pl
#!C:perlbinperl -w
use strict;
sub print_header()
{
print "This is Header function! ";
}
sub print_footer()
{
print "This is Footer function! ";
}
print_header();
print_footer();
总结:
设置Apache支持cgi和支持SSI的时候有个相同的部分,设置目录Directory,而且需要设置为相同的。
因此,如果单使用ssi的话,可以按照ssi的设置进行配置,将shtml等放置到设置的目录下;
如果已设置Apache支持cgi,只需要打开ssi,同时将shtml等文件放置到cgi的目录中即可。