Project

General

Profile

Starting lighttpd with fastcgi and local unix-domain socket failed

Added by Toru almost 14 years ago

/etc/lighttpd.conf:

...
server.modules = (
"mod_fastcgi"
)
server.username = "_lighttpd"
server.groupname = "_lighttpd"
fastcgi.server = (
".fcgi" =>
((
"socket" => "/tmp/a.out.socket",
"bin-path" => "/tmp/a.out"
))
)
...
I run as root:
spawn-fcgi \-s /tmp/a.out.socket \-n \-u _lighttpd \-g _lighttpd \-U _lighttpd \-G _lighttpd -- /tmp/a.out

ps aux:

...
_lighttpd 28973 0.0 0.2 448 596 p1 I+ 2:33PM 0:00.01 /tmp/a.out
...

ls -ltr /tmp

-rwxr-xr-x  1 _lighttpd  _lighttpd  6992 Jul 16 13:38 a.out
srwxr-xr-x 1 _lighttpd _lighttpd 0 Jul 16 14:33 a.out.socket

Now I try to start lighttpd as root:

/usr/local/sbin/lighttpd -f /etc/lighttpd.conf

The logfile contains the following error:

2011-07-16 14:39:23: (log.c.166) server started
2011-07-16 14:39:23: (mod_fastcgi.c.1367) --- fastcgi spawning local
proc: /tmp/a.out
port: 0
socket /tmp/a.out.socket
max-procs: 4
2011-07-16 14:39:23: (mod_fastcgi.c.1391) --- fastcgi spawning
port: 0
socket /tmp/a.out.socket
current: 0 / 4
2011-07-16 14:39:23: (mod_fastcgi.c.978) bind failed for: unix:/tmp/a.out.socket-0 No such file or directory
2011-07-16 14:39:23: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed.
2011-07-16 14:39:23: (server.c.938) Configuration of plugins failed. Going down.

What is wrong with my configuration? I run OpenBSD 4.9 with lighttpd 1.4.28.

Many thanks in advance

Toru


Replies (7)

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by icy almost 14 years ago

You use max-procs in the fastcgi config (which also means you didn't paste all of it).
This maxes lighty spawn 4 backends and it appends a dash + numeric index as suffix to the socket path because each one needs its own socket.

Also specifying the binary makes lighty spawn the backend, you don't need to spawn it again using spawn-fcgi if you do it like this.

So either spawn-fcgi or binary specified in lighty. I suggest using spawn-fcgi as it gives more flexibility.

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by Toru almost 14 years ago

Many thanks. Now I use spawn-fcgi only and the server starts correctly but I get an error if I visit a fcgi page:

2011-07-16 16:06:52: (mod_fastcgi.c.1734) connect failed: No such file or directory on unix:/tmp/a.out.socket
2011-07-16 16:06:52: (mod_fastcgi.c.455) backend disabled for 1 seconds
2011-07-16 16:06:52: (mod_fastcgi.c.3027) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2011-07-16 16:06:54: (mod_fastcgi.c.2854) fcgi-server re-enabled: unix:/tmp/a.out.socket

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by icy almost 14 years ago

Well, that means the file is not there.

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by Toru almost 14 years ago

ls -ltr /tmp

-rwxr-xr-x  1 _lighttpd  _lighttpd  6992 Jul 16 13:38 a.out
srwxr-xr-x 1 _lighttpd _lighttpd 0 Jul 16 16:20 a.out.socket

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by icy almost 14 years ago

Are you putting lighty in a chroot maybe?

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by Toru almost 14 years ago

I have moved the whole stuff into /var/www/lighttpd but get the same error.

RE: Starting lighttpd with fastcgi and local unix-domain socket failed - Added by Toru almost 14 years ago

Solved! Lighty was running in a chroot. Thanks a lot.

    (1-7/7)