httpd的cgi-bin配置

时间:2014-03-26 11:43:27

标签: php apache cgi httpd.conf

我正在尝试使用apache配置cgi 我在httpd.conf文件中进行了以下更改 未注释

AddHandler cgi-script .cgi

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options +ExecCGI
    Require all granted
</Directory>

service httpd restart

但无法执行,它在logs / error_log文件中给出以下错误

[Wed Mar 26 17:08:22.088316 2014] [mime_magic:error] [pid 7760] [client ::1:59024] AH01512: mod_mime_magic: can't read `/var/www/cgi-bin/hello.cgi'
[Wed Mar 26 17:08:22.089486 2014] [cgi:error] [pid 7760] [client ::1:59024] AH01215: (13)Permission denied: exec of '/var/www/cgi-bin/hello.cgi' failed
[Wed Mar 26 17:08:22.090045 2014] [cgi:error] [pid 7760] [client ::1:59024] End of script output before headers: hello.cgi

1 个答案:

答案 0 :(得分:1)

来自here

  

问题是SELinux的安全性阻止了mod_mime_magic访问测试程序。

     

当程序的上下文(在本例中为testprogram)与目录不匹配时,会发生这种情况。   要更改为适当的上下文,请使用UNIX命令&#34; chcon&#34;。

阅读以下文章了解详情:Apache and SELinux