我有我的index.py
在/var/www/cgi-bin
设置cgi-bin目录服务器蟒蛇与apache2.4.18
我index.py
看起来是这样的:
#!/usr/bin/python
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'
我的Apache2 /etc/apache2/sites-enabled/000-default.conf
看起来是这样的:
<VirtualHost *:80>
<Directory /var/www/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi .py
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
让我知道如果还有其他事情需要修改,我已经启用了cgi。
的问题是,无论什么网址我访问我不断收到错误未找到localhost,或localhost/index.py
我的Apache的知识是有点生疏,但'index.py'有它的执行权限位设置? –
是'chmod 755' – harshil9968
你是直接尝试127.0.0.1,而不是本地主机? – Manel