Project

General

Profile

[Solved] problem installing python support

Added by krestensb over 10 years ago

Hi,

I'm trying to setup a lighttpd webserver on my raspberry pi with support for python.8

I followed the guide on https://wiki.archlinux.org/index.php/lighttpd

I get a fine html test page on localhost, but I can't run a .py script. I've never set up a webserver before, so I might have done something trivial wrong.

I'm not sure where to put my script. I tried both /srv/http/cgi-bin/index.py and /srv/http/index.py I get

"Unable to connect" when I open 192.168.0.106/index.py

I hope someone can help me out.

My /etc/lighttpd/lighttpd.conf is as follows, and my /etc/lighttp/conf.d/cgi-conf is pasted in below.

lighttpd.conf:

# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOpti$

include "conf.d/cgi.conf" 

server.port             = 80
server.username         = "http" 
server.groupname        = "http" 
server.document-root    = "/srv/http" 
server.errorlog         = "/var/log/lighttpd/error.log" 
dir-listing.activate    = "enable" 
index-file.names        = ( "index.html" )
mimetype.assign         = (
                            ".html" => "text/html",
                            ".txt" => "text/plain",
                            ".css" => "text/css",
                            ".js" => "application/x-javascript",
                            ".jpg" => "image/jpeg",
                            ".jpeg" => "image/jpeg",
                            ".gif" => "image/gif",
                            ".png" => "image/png",
                            "" => "application/octet-stream" 
                    )

#server.modules = (
"mod_access",
"mod_alias",    
"mod_compress",
"mod_redirect",
"mod_cgi",
"mod_rewrite",
)

$HTTP["url"] =~ "^/cgi-bin/" {
cgi.assign = (".py" => "/usr/bin/python")
}

cgi.conf:

server.modules += ( "mod_cgi" )

cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                           ".cgi" => "/usr/bin/perl",
                           ".rb"  => "/usr/bin/ruby",
                           ".erb" => "/usr/bin/eruby",
                           ".py"  => "/usr/bin/python2",
                           ".php" => "/usr/bin/php-cgi" )

index-file.names           += ( "index.pl",   "default.pl",
                           "index.rb",   "default.rb",
                           "index.erb",  "default.erb",
                           "index.py",   "default.py",
                           "index.php",  "default.php" )

Replies (1)

RE: [Solved] problem installing python support - Added by gstrauss almost 8 years ago

"Unable to connect" is more indicative of lighttpd not running.
Try running the following on the server: lighttpd -t -f /etc/lighttpd/lighttpd.conf
Also, check the lighttpd error.log

    (1-1/1)