为什么cgi脚本必须保留在cgi-bin文件夹中?

时间:2010-03-20 13:25:59

标签: apache cgi webserver cgi-bin

为什么cgi脚本必须保留在cgi-bin文件夹中?

在public_html文件夹和cgi-bin文件夹中插入python脚本(或php脚本或任何其他脚本)有什么区别?

我不明白: - \

2 个答案:

答案 0 :(得分:5)

他们没有。唯一的限制是CGI脚本必须位于具有

的目录中
Options +ExecCGI

指令已打开,并且在默认的Apache配置中,/ cgi-bin目录已启用此选项。但没有什么能阻止你在其他目录中启用CGI。

有些人认为将所有CGI脚本放在一个地方更安全。

答案 1 :(得分:0)

它不必在cgi-bin中,但你必须指定在哪里!例如,我移动到我的index.htm文件所在的主www文件夹。

#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"  <-This was the original
ScriptAlias /html/ "/var/www/html"
#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#Directory below used to be /var/www/cgi-bin
<Directory "/var/www/html">
    AllowOverride None
    Options ExecCGI <-this line used top be Options None
    Order allow,deny
    Allow from all
</Directory>
相关问题