Hi,

I am trying to run python scripts with lighttpd. So I am using lighttpd and 
fastcgi as the interface between the server and the pi.
Lighttpd was already installed on my pi and is working fine. 
lighttpd.conf is as follows,

pi@raspberrypi /etc/lighttpd $ cat lighttpd.conf
server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
#       "mod_rewrite",
        "mod_fastcgi",
)

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"                                                      
                                   )
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/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"

fastcgi.server = (
   ".py" => (
     "python-fcgi" => (
       "socket" => "/tmp/fastcgi.python.socket",
       "bin-path" => "/var/www/doStuff.py",
       "check-local" => "disable",
       "max-procs" => 1)
    )
 )
However when I try to restart lighttpd I get errors.

pi@raspberrypi /etc/lighttpd $ sudo service lighttpd restart
Duplicate config variable in conditional 0 global: fastcgi.server
2013-12-27 16:08:05: (configfile.c.951) source: /etc/lighttpd/lighttpd.conf 
line: 39 pos: 1 parser failed somehow near here: (EOL)

Then I commented out the block of code 

#fastcgi.server = (
  # ".py" => (
    # "python-fcgi" => (
      # "socket" => "/tmp/fastcgi.python.socket",
       #"bin-path" => "/var/www/doStuff.py",
       #"check-local" => "disable",
       #"max-procs" => 1)
    #)
 #)
Trying to restart lighttpd then gives,

pi@raspberrypi /etc/lighttpd $ sudo service lighttpd restart
[ ok ] Stopping web server: lighttpd.
[....] Starting web server: lighttpd2013-12-27 16:12:53: (plugin.c.131) 
Cannot load plugin mod_fastcgi more than once, please fix your config (we 
may not accept such configs in future releases
2013-12-27 16:12:53: (network.c.405) can't bind to port:  80 Address 
already in use
 failed!
If I can't use this block of code then how can I tell lighttpd where to 
find the python script doStuff.py ?
Next I commented out

#        "mod_fastcgi",
at the beginning of lighttpd.conf
This gives,

pi@raspberrypi /etc/lighttpd $ sudo service lighttpd restart
[ ok ] Stopping web server: lighttpd.
[....] Starting web server: lighttpd2013-12-27 16:15:03: (network.c.405) 
can't bind to port:  80 Address already in use
 failed!
So it seems that I am twice configuring lighttpd. Where else is this 
happening and how do I tell lighttpd where to find the python script?

The contents of /etc/lighttpd/conf-enabled are interesting as this file 
contains a block of code starting with fastcgi.server Perhaps this is where 
the previously commented out block should be. But how would I place that 
information here? Currently this config file seems to be enabling php, so 
how do I get it to enable python?

pi@raspberrypi /etc/lighttpd/conf-enabled $ cat 15-fastcgi-php.conf
# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# 
http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "/var/run/lighttpd/php.socket",
                "max-procs" => 1,
                "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "4",
                        "PHP_FCGI_MAX_REQUESTS" => "10000"
                ),
                "bin-copy-environment" => (
                        "PATH", "SHELL", "USER"
                ),
                "broken-scriptfilename" => "enable"
        ))
)Any help would be appreciated,Thanks,Shane

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to