关于Linux的虚拟目录

文章编号:01024
以Cybozu Office为例,对Linux的虚拟目录进行说明。

apache中的“虚拟目录”在Apache配置文件“httpd.conf”中定义为Script Alias(CGI可执行目录)。

安装Cybozu, Inc.产品时,安装程序在“设置安装标识符”和“设置CGI目录”中显示安装目录的初始状态。

(CGI目录)/(安装标识符)是安装目录的初始状态。

如果要将Cybozu, Inc.产品安装到与安装程序最初显示的目录不同的位置,则必须在“httpd.conf”中将该目录设置为Script Alias。

示例:将安装目录和访问URL设置为:

  • 安装目录:/cgi/cybozu/cbag
  • 访问URL:http://服务器名称/cybozu/cbag/ag.cgi?

在“httpd.conf”中,添加以下内容:
ScriptAlias /cybozu/ "/cgi/cybozu/"
<Directory "/cgi/cybozu">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

# 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 ScriptsAlias directives as to
# Alias.
# ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
# < Directory "/var/www/cgi-bin">
#    AllowOverride None
#    Options ExecCGI
#    Order allow,deny
# < /Directory>
######################################
ScriptAlias /cybozu/ "/cgi/cybozu/"
<Directory "/cgi/cybozu">
  AllowOverride None
  Options ExecCGI
  Order allow,deny
  Allow from all
</Directory>
######################################

更改设置后重新启动Apache,将反映设置的内容。
如上所述,在“httpd.conf”Script Alias中设置的目录可以在安装时指定为安装目标(“设置安装标识符”和“设置 CGI 目录”)。