[英]403 forbidden when use CGI in apache in mac os x
mac 10.12.6
Apache的配置
LoadModule cgi_module libexec/apache2/mod_cgi.so
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/cgi-bin/$1"
<Directory "/Library/WebServer/cgi-bin/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
AddHandler cgi-script .cgi
</Directory>
AddHandler cgi-script .cgi
和文件ls -l
user:cgi-bin root# ls -l
total 8
-rwxr-xr-x@ 1 user wheel 60 Oct 27 21:57 server.cgi
那是命令行中的测试
root# /library/webserver/cgi-bin/server.cgi
Content-type:text/plain
hello world
如果我去
http://localhost/cgi-bin/server.cgi
其回应:
Forbidden
You don't have permission to access /cgi-bin/server.cgi on this server.
我已经尽力了。
耶哈,我发现了问题
这是Apache 2.4的问题
您必须检查允许和拒绝规则
查看http://httpd.apache.org/docs/2.4/upgrading.html#access
在2.2中,使用指令Order,Allow,Deny和Satisfy完成了基于客户机主机名,IP地址和客户机请求其他特征的访问控制。
在2.4中,使用新模块mod_authz_host以与其他授权检查相同的方式完成这种访问控制。 新指令为Require:
2.2配置:
Order allow,deny
Allow from all
2.4配置:
Require all granted
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.