当我尝试访问时http://host-ip/~ec2-user/cgi-bin/try.cgi
,出现403 Forbidden
错误,error_log
显示Options ExecCGI is off in this directory: /home/ec2-user/public_html/cgi-bin/try.cgi
。如果我注释掉AddHandler
行,我可以看到脚本文本。以下是一些基本信息。你知道是什么阻止服务器解析 CGI 脚本吗?谢谢!
[ec2-user@ip-10-245-79-145 cgi-bin]$ uname -a
Linux ip-10-245-79-145 3.4.37-40.44.amzn1.x86_64 #1 SMP Thu Mar 21 01:17:08 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user@ip-10-245-79-145 cgi-bin]$ apachectl -v
Server version: Apache/2.2.24 (Unix)
Server built: Apr 30 2013 22:53:39
[ec2-user@ip-10-245-79-145 cgi-bin]$ tail /etc/httpd/conf/httpd.conf
<Directory "/home/ec2-user/public_html/cgi-bin/">
Options +ExecCGI
AddHandler cgi-script .cgi
Order allow,deny
Allow from all
</Directory>
目录中没有.htaccess
文件/home/ec2-user/public_html/cgi-bin/
,没有SELinux
运行,suexec.log
什么都不显示。
答案1
读完后我终于明白了原因如何合并章节,在我的 httpd.conf 中注释掉以下几行之后,我的脚本就可以正常工作了:
<Location />
Options Includes
AddHandler server-parsed .shtml
</Location>