[請益] cgi請益

看板PHP作者 (qq)時間10年前 (2015/07/08 14:29), 編輯推噓0(005)
留言5則, 4人參與, 最新討論串1/1
請問一下版友,目前我在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://www.ptt.cc/bbs/PHP/M.1436336999.A.0CF.html

07/08 17:07, , 1F
錯版?
07/08 17:07, 1F

07/09 13:03, , 2F
哥覺得你第一行就寫錯了
07/09 13:03, 2F

07/09 13:03, , 3F
應該是 #!/usr/bin/python 吧...
07/09 13:03, 3F

07/11 14:01, , 4F
修改成樓上的路徑仍然不行
07/11 14:01, 4F

07/11 18:55, , 5F
cgi.assign 那行寫錯?改成 /usr/bin/python 看看
07/11 18:55, 5F
文章代碼(AID): #1LdCDd3F (PHP)
文章代碼(AID): #1LdCDd3F (PHP)