I've installed lighttpd and gotten it to serve /var/www/index.html
just fine, but I haven't gotten it to run a Python script yet.
I enabled CGI and set it's match case and directory as instructed in this SO answer. In short, I added mod_cgi
to server.modules()
and gave it a regex rule
$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = ( ".py" => "/usr/bin/python" )
}
For my test file /var/www/cgi-bin/test.py
:
print "Content-Type: text/html"
print ""
print "<body>"
print "TEST"
print "</body>"
print "</html>"
When I enter the url raspberrypi.local
or my IP, I get the file /var/www/index.html
as expected. When I request the url raspberrypi.local/cgi-bin/test.py
or raspberrypi.local/test.py
I get a 404 error.
How can I solve this problem?
EDIT: I've also found this tutorial which is very good, and says pretty much the same thing. I'm still getting the 404 error.
"/var/www/cgi-bin/"
, with a slash at the end. – xtofl Nov 04 '18 at 12:54