Web-Server
Centos 5.5 - 從多個位置執行 cgi 腳本
我希望能夠從 /var/www/cgi-bin 以外的其他位置執行 cgi 腳本,例如:
/var/www/folder1/cgi-bin /var/www/folder2/cgi-bin /var/www/folder3/cgi-bin
我該如何配置伺服器來執行此操作?
編輯:這是從我個人託管的網路伺服器上的網站執行 cgi 腳本。
有兩種方法可以做到這一點:
1)設置虛擬主機,並在每個虛擬主機下,指定
ScriptAlias /cgi-bin/ "/your/location"
2)在下創建子文件夾
/var/www/cgi-bin
並使用子文件夾連結到它們,但是使用此方法,您不能離開/var/www/cgi-bin
目錄樹。
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>