Project

General

Profile

[UE] lighttpd with non-root user and fastcgi failing with error daemonized server failed to start

Added by bhanu.kvn about 3 years ago

Hi

When I am running lighttpd(server.username ="testServer" and server.groupname ="testServer") which has fastcgi failing with the error "daemonized server failed to start"

Requirement :
I want the lighttpd with fastcgi, and the service/process has to run with other than root user.

Below is lighttpd.conf file

server.modules = (
        "mod_alias",
        "mod_cgi",
        "mod_access",
        "mod_fastcgi",
        "mod_setenv",
        "mod_openssl")
server.document-root = "/var/www" 
server.username = "testServer" 
server.groupname = "testServer" 
server.event-handler = "poll" 
    mimetype.assign = (
    ".css"          =>      "text/css",
    ".wav"          =>      "audio/x-wav",
    ".gif"          =>      "image/gif",
    ".jpg"          =>      "image/jpeg",
    ".jpeg"         =>      "image/jpeg",
    ".png"          =>      "image/png",
    ".html"         =>      "text/html",
    ".htm"          =>      "text/html",
    ".js"           =>      "text/javascript",
    ".conf"         =>      "text/plain",
    ".text"         =>      "text/plain",
    ".txt"          =>      "text/plain",
    ".dtd"          =>      "text/xml",
    ".xml"          =>      "text/xml",
    ".tar"          =>      "application/x-tar",
    ".zip"          =>      "application/zip")
    index-file.names = ( "index.html", "index.htm" )
    alias.url += ( "" => server.document-root )

fastcgi.server = ( "/cgi-bin" => (
        "TestWebServer.handler" => (
                "socket" => "/run/TestWebServer.socket",
                "check-local" => "enable",
                "bin-path" => "/var/www/cgi-bin/TestWebServer.cgi",
                "max-procs" => 1,
                )
        )
    )

server.http-parseopts = ("host-strict" => "disable")
server.upload-dirs = ( "/run" )
server.bind = "0.0.0.0" 
server.port = 80
$SERVER["socket"] == "[::]:80" { } 

Observation
1. with server.username = "testServer" and server.groupname = "testServer"
When I executed below command with above lighttpd.conf file
/usr/sbin/lighttpd -f lighttpd.conf
daemonized server failed to start

2. with server.username = "root" and server.groupname = "root" the lighttpd and fastcfi service started successfully without any error.

3. I able to launch the lighttpd service successfully with different user (other than root) when I remove the fastcgi configuration in the above lighttpd.conf file

Query
Is there any issues in the above script, why lighttpd service failed with server.username = "testServer" and server.groupname = "testServer" and fastcgi configuration?


Replies (1)

RE: lighttpd with non-root user and fastcgi failing with error daemonized server failed to start - Added by gstrauss about 3 years ago

/usr/sbin/lighttpd -f lighttpd.conf
daemonized server failed to start

Look here. Look in the lighttpd error log.
See How to get help
Try running /usr/sbin/lighttpd -f lighttpd.conf -D to keep lighttpd in the foreground, and press Ctrl-C (after starting lighttpd) to quit.

"bin-path" => "/var/www/cgi-bin/TestWebServer.cgi" is likely failing to start. testServer probably does not have permission to write to "socket" => "/run/TestWebServer.socket"

There should be error trace from lighttpd, and the error can be confirmed with strace

    (1-1/1)