我希望能够从/ var / www / cgi-bin之外的其他位置运行cgi脚本,例如:
/var/www/folder1/cgi-bin /var/www/folder2/cgi-bin /var/www/folder3/cgi-bin
我如何去configuration服务器来做到这一点?
编辑:这是从我个人托pipe的Web服务器上的网站运行CGI脚本。
ScriptAlias是你的叔叔。
来自: http : //httpd.apache.org/docs/2.2/mod/mod_alias.html#scriptalias
Description: Maps a URL to a filesystem location and designates the target as a CGI script Syntax: ScriptAlias URL-path file-path|directory-path Context: server config, virtual host Status: Base Module: mod_alias The ScriptAlias directive has the same behavior as the Alias directive, except that in addition it marks the target directory as containing CGI scripts that will be processed by mod_cgi's cgi-script handler. URLs with a case-sensitive (%-decoded) path beginning with URL-path will be mapped to scripts beginning with the second argument, which is a full pathname in the local filesystem. Example: ScriptAlias /cgi-bin/ /web/cgi-bin/ A request for http://example.com/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo. This configuration is essentially equivalent to: Alias /cgi-bin/ /web/cgi-bin/ <Location /cgi-bin > SetHandler cgi-script Options +ExecCGI </Location>
有两种方法可以实现这一点:
1)安装虚拟主机,并在每个虚拟主机下,指定ScriptAlias /cgi-bin/ "/your/location"
2)在/var/www/cgi-bin下创build子文件夹,并使用子文件夹链接到它们,但是使用这种方法不能离开/var/www/cgi-bin目录树。