#!/usr/bin/python3
print "Content-type: text/html\n"
print "Hello, world!"
我在计算机上安装了多个版本的Python。我找不到我的cgi启用目录,所以我把这段代码粘贴到了三个地方:
- /usr/lib/cgi-bin/first.py
- /usr/lib/cups/cgi-bin/first.py
- /var/www/html/first.py
curl http://localhost/first.py
时,它只会输出简单的文本而不是执行。我已经给予first.py所有权限。
我通过以下命令启用和启动服务器:
a2enmod cgi
systemctl restart apache2
请告诉我如何执行并解决问题?谢谢。