使用fastcgi和本地unix-domain套接字启动lighttpd失败

时间:2011-07-16 12:50:54

标签: fastcgi lighttpd openbsd

/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"
   ))
)
...

我以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

现在我尝试以root身份启动lighttpd:

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

日志文件包含以下错误:

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.

我的配置有什么问题?我运行OpenBSD 4.9。

非常感谢提前

1 个答案:

答案 0 :(得分:2)

Lighttpd被chrooted。要解决上述问题,请在/etc/lighttpd.conf中注释掉“server.chroot”。