我试图在我的Mac的Web服务器上运行python cgi脚本。 每次我访问文件@ localhost / site.py我得到一个403禁止的错误。
我在看我的Apache的错误日志,它说:
[Mon Jun 11 09:52:42 2012] [error] [client ::1] Options ExecCGI is off in this directory: /Users/<username>/Sites/site.py
我已经改变了我的httpd.conf文件,以便我的文档根目录是/ Users // Sites
在我的用户的.conf文件中,我有以下内容:
<Directory "/Users/<username>/Sites/"> Options All AllowOverride All Order allow,deny Allow from all AddHandler cgi-script .py </Directory>
为什么它告诉我ExecCGIclosures,当我允许我的用户的.conf文件中的所有选项?
你使用的是内置的apache2,或者像XAMPP这样的软件包吗? 我发现XAMPP不使用user.conf,必须编辑/Applications/XAMPP/etc/httpd.conf。
另一件事情是在apache重新启动后,user.conf的更改生效。