1.首先明確,只能夠指定某個確定的目錄,支持cgi,即運行該目錄執行cgi程序;否則不太安全。
尋找:
代碼如下:
#
# "C:/Program Files/Apache Group/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/Website_Field/cgi">
AllowOverride all
Options all
Order allow,deny
Allow from all
</Directory>
設置Directory為可以執行cgi的目錄
2.
尋找:
代碼如下:
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "E:/Website_Field/cgi"
將之后的目錄改成和上面的相同。
3.
設置cgi腳本的后綴,尋找:
代碼如下:
#
# AddHandler allows you to map certain file extensions to "handlers",
# actions unrelated to filetype. These can be either built into the server
# or added with the Action command (see below)
#
# If you want to use server side includes, or CGI outside
# ScriptAliased directories, uncomment the following lines.
#
# To use CGI scripts:
#
AddHandler cgi-script .cgi .pl
設置后綴如.cgi, .pl等等,任意可以想到的,但是避免使用已有的如.html, .asp, .php等
注意:設置支持cgi的目錄之后,該目錄下的內容及子目錄的內容都可以執行。
配置Apache支持SSI,即服務器端解析的server-parsed html(shtml)
關于什么是SSI以及什么是shtml,請參看本站的其他兩篇文章。
使用SSI可以實現html的動態嵌入內容,可以為一下SSI的命令,甚至是系統返回結果,以及比較常用的調用Perl程序(尤其是perl的cgi返回結果)
1. 配置Apache:
1)首先找到:
代碼如下:
#
# To use server-parsed HTML files
#
AddType text/html .shtml
AddHandler server-parsed .shtml
去掉后兩行之前的#號;
新聞熱點
疑難解答