Q
Q
Quad_Tree2018-02-25 15:04:35
linux
Quad_Tree, 2018-02-25 15:04:35

Why doesn't fastcgi work on lighttpd?

I wrote a web application in Python and created the following script for it:

#!/usr/bin/python3
from flup.server.fcgi import WSGIServer
import app

if __name__ == '__main__':
        WSGIServer(app).run()

Then I set up the lighttpd web server:
server.modules = (
  "mod_access",
  "mod_alias",
  "mod_compress",
 	"mod_redirect"
)

server.document-root        = "/var/www/html"
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" )

url.rewrite-once = (
    "^(/static($|/.*))$" => "$1",
    "^(/.*)$" => "/application.fcgi$1"
)

# 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"

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/python",
                               ".php" => "/usr/bin/php-cgi" )

server.modules += ( "mod_fastcgi" )
fastcgi.server = (
  "/application.fcgi" =>
  ((
    "socket" => "/tmp/application-fcgi.sock",
    "bin-path" => "/var/www/html/controlpanel/application.fcgi",
    "check-local" => "disable",
    "max-procs" => 1
  ))
)

But when starting lighttpd, it starts throwing the following errors into the log:
2018-02-25 15:49:01: (log.c.217) server started 
2018-02-25 15:49:01: (mod_fastcgi.c.1159) the fastcgi-backend /var/www/html/controlpanel/application.fcgi failed to start: 
2018-02-25 15:49:01: (mod_fastcgi.c.1163) child exited with status 1 /var/www/html/controlpanel/application.fcgi 
2018-02-25 15:49:01: (mod_fastcgi.c.1166) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.\nIf this is PHP on Gentoo, add 'fastcgi' to the USE flags. 
2018-02-25 15:49:01: (mod_fastcgi.c.1518) [ERROR]: spawning fcgi failed. 
2018-02-25 15:49:01: (server.c.1269) Configuration of plugins failed. Going down.

I did lighty-enable-mod fastcgi but that didn't help much either.
What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex F, 2018-02-25
@delvin-fil

With this setup it seems to work.
s_1519574954_6281129_4cbf345d06.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question