Mar 8

[原]Apache 中设置全目录执行 CGI 雷阵雨

linuxing , 19:15 , 网络服务 » 常见服务 , 评论(0) , 引用(0) , 阅读(22505) , Via 本站原创 | |
    默认情况下,Apache 只允许在cgi-bin目录下执行 CGI 程序,而不像lighttpd等可以全目录下运行。但有时候为了方便使用或调试,我们希望全部目录都能执行CGI。下面是解决方法。

打开Apache设置文件/etc/httpd/conf/httpd.conf,修改:
引用
#AddHandler cgi-script .cgi

为:
引用
AddHandler cgi-script .cgi .pl


然后把:
引用
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>

改为:
引用
<Directory />
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride None
</Directory>

也就是在第二行最后,增加ExecCGI,最后重启动Apache即可:

# service httpd restart

同样的,如果您设置了虚拟主机的话,请对根目录进行相同的配置。

Tags: ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]