Project

General

Profile

[Solved] Set up communication between fcgiapp and lighty via the unix socket

Added by DecayAssault about 1 year ago

Lubuntu
uname -r
5.15.0-67-generic

lighttpd -v
lighttpd/1.4.63 (ssl) - a light and fast webserver

sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf
2023-03-06 14:21:22: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_fastcgi

lighttpd -p -f /etc/lighttpd/lighttpd.conf
2023-03-06 14:22:13: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_fastcgi
config {
    var.CWD                        = "/home/lovelake" 
    var.PID                        = 3740
    server.document-root           = "/var/www/html" 
    server.modules                 = ("mod_deflate", "mod_ssi", "mod_setenv", "mod_vhostdb", "mod_fastcgi")
    server.port                    = 80
    server.tag                     = "" 
    server.bind                    = "127.0.0.1" 
    server.protocol-http11         = "disable" 
    server.username                = "www-data" 
    server.groupname               = "www-data" 
    deflate.cache-dir              = "/var/www/cache" 
    deflate.mimetypes              = (
        "text/html",
        "text/plain",
        "text/css",
        "text/javascript",
        "text/xml",
        "image/x-icon",
        "image/jpeg",
    )
    deflate.allowed-encodings      = ("br", "gzip", "deflate", "zstd")
    setenv.add-response-header     = (
        "X-Frame-Options" => "deny",
    )
    vhostdb.cache                  = (
        "max-age" => "600",
    )
    mimetype.assign                = (
        ".htm"  => "text/html",
        ".css"  => "text/css",
        ".js"   => "text/javascript",
        ".ico"  => "image/x-icon",
        ".jpg"  => "image/jpeg",
        ".jpeg" => "image/jpeg",
        ".txt"  => "text/plain",
        ".xml"  => "text/xml",
    )
    static-file.exclude-extensions = (".out", ".fcgi", ".php")
    index-file.names               = ("p.htm", "i.htm", "0.htm")
    ssi.extension                  = (".htm")

    $HTTP["host"] == "localhost" {
        # block 1
        fastcgi.server = (
            ".fcgi" => (
                (
                    "bin-path"    => "/var/www/html/a.out",
                    "socket"      => "/tmp/hello_fastcgi.sock",
                    "check-local" => "disable",
                    "max-procs"   => 1,
                    "min-procs"   => 1,
                ),
            ),
        )

    } # end of $HTTP["host"] == "localhost" 
}

Firefox
FCGX_Init();
int socket = FCGX_OpenSocket("/dev/stdin", 1);
FCGX_InitRequest(&request, socket, 0);
while (FCGX_Accept_r(&request) == 0)
{
    FCGX_Finish_r(&request);
}

Hello! There https://serverfault.com/a/520629 is an answer about fcgi.server usage. Be carefully, I didn't understand and can't find using Google how to properly set up communication between fcgiapp and lighty. Could you explain, please, what unix socket names do I need to use?


Replies (3)

RE: Set up communication between fcgiapp and lighty via the unix socket - Added by gstrauss about 1 year ago

Hi. You posted on the lighttpd forums and referenced a 9+ year old stackoverflow post.

Did you try reading the mod_fastcgi documentation on this site, the site that contains the official lighttpd documentation?

RE: Set up communication between fcgiapp and lighty via the unix socket - Added by DecayAssault about 1 year ago

Sorry, it is not a spam. I have read the doc now and I've found right answer: socket in InitRequest must be set at 0 instead of OpenSocket usage. Thank you for the reply!

RE: Set up communication between fcgiapp and lighty via the unix socket - Added by gstrauss about 1 year ago

Glad you found your answer: FCGI_LISTENSOCK_FILENO (which is 0) since the listening socket is already opened by lighttpd.

    (1-3/3)