作者pujols05 (qq)
看板PHP
標題[請益] cgi請益
時間Wed Jul 8 14:29:57 2015
請問一下版友,目前我在raspberry pi上設定cgi會出現500error訊息
以上提供我設定的內容,可以幫我看哪裡有錯嗎?我是安裝lighttpd
#這是我的測試程式我有設定chmod 755'放在/var/www/cgi-bin下檔名是index.py
--------------------
#!/usr/lib/python2.7
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>'
---------------------------
以下是lighttpd.conf的設定
--------------------------------------
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_cgi",
"mod_rewrite",
)
server.document-root = "/var/www"
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", "index.py" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi",".py" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# 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"
cgi.assign = ( ".py" => "/usr/lib/python2.7" )
--------------------------------------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.224.211.114
※ 文章網址: https://webptt.com/m.aspx?n=bbs/PHP/M.1436336999.A.0CF.html
1F:→ y2468101216: 錯版? 07/08 17:07
2F:→ shadowjohn: 哥覺得你第一行就寫錯了 07/09 13:03
3F:→ shadowjohn: 應該是 #!/usr/bin/python 吧... 07/09 13:03
4F:→ pujols05: 修改成樓上的路徑仍然不行 07/11 14:01
5F:→ Neisseria: cgi.assign 那行寫錯?改成 /usr/bin/python 看看 07/11 18:55