Python脚本未在lighttpd下执行
我在Debian手下, 使用“apt get install”安装python和lighttpd 这是我的lighttpd配置文件:Python脚本未在lighttpd下执行,python,lighttpd,Python,Lighttpd,我在Debian手下, 使用“apt get install”安装python和lighttpd 这是我的lighttpd配置文件: server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_cgi" ) server.document-root =
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_cgi"
)
server.document-root = "/var/www/html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/$
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
# configuration cgi-python
$HTTP["url"] =~ "^cgi-bin/" {
cgi.assign = ( ".py" => "/usr/bin/python" )
}
我在/var/www/html/cgi-bin下有这个文件/
-rwxr-xr-x 1 www-data www-data 245 mai 19 12:09 hello.py
hello.py:
#! /usr/bin/python
#
print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print '<title>Rapsberry Pi</title><p>'
for count in range(1,100):
print 'Hello World...'
print "</p></body></html>"
#/usr/bin/python
#
打印“内容类型:text/html\n\n”
打印“
打印“Rapsberry Pi”
对于范围内的计数(1100):
打印“你好,世界…”
打印“”
我的问题是浏览器不执行我的文件并显示我的.py代码。
/var/log/lighttpd/error.log中没有错误
有人知道哪里出了问题吗?这里的文档:
似乎您还需要设置cgi.assign
,例如:
cgi.assign = ( ".pl" => "/usr/bin/perl",
".cgi" => "/usr/bin/perl",
".rb" => "/usr/bin/ruby",
".erb" => "/usr/bin/eruby",
".py" => "/usr/bin/python",
".php" => "/usr/bin/php-cgi" )
伟大的我删除了lighttpd.conf中的cgi conf,并启用了10-cgi.confI,希望web服务器能够为此类常见任务提供更好的文档。许多开发人员使用Python作为后端,但官方文档很少:(