What is the correct Lighttpd configuration for a daemon implementing FastCGI++ library?

724 Views Asked by At

(Also posted to the FastCGI++-users mail list, however it is not been active in a significant length of time)

I am currently attempting to use the FastCGI++ (version 2.1) library within an application I am writing. The application will run as a daemon on a linux machine, with a status webpage served through lighttpd. I'm intending to use the FastCGI++ interface to periodically, automatically update the status webpage.

I have started by adding a thread to my application which creates an instance of the FastCGI++ Manager, and echos a string literal in response to any request (essentially the same as the Hello World example).

However, I cannot seem to access this in the browser, and I suspect I have incorrectly configured the lighttpd fastcgi module (/etc/lighttpd/lighttpd.conf included below). The lighttpd error log records that there is "No such file or directory on unix: /tmp/Myapp.sock".

What is the correct way of configuring lighttpd to interface with a daemon implementing the fastcgi++ library? Is it a necessity to launch the daemon with spawn-fcgi?

Thanks,

Mike

cat /etc/lighttpd/lighttpd.conf:

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

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

cgi.assign = (".py" => "/usr/bin/python3")
fastcgi.debug = 1
fastcgi.server = ( "/device" => (( 
                    "socket" => "/tmp/Myapp.sock",
                    "check_local" => "disable",
                    "docroot" => "/"
                ))
        )

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

There are 1 best solutions below

2
On

"No such file or directory on unix: /tmp/Myapp.sock"

That means that the socket is missing.

Is your daemon running? Did you start it up?

If you want lighttpd to start up the daemon, then you have to include "bin-path" in the fastcgi.server settings for your "/device". See https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModFastCGI