项目

通用

个人资料

操作

在 daemontools/supervise 下运行 Lighttpd

Lighttpd 非常适合在 Daniel J. Bernstein 的 daemontools 软件包中的 "supervise" 程序监控下运行。

要进行设置,您必须首先创建一个标准的服务目录结构。在以下示例中,进程启动的服务目录将是 /srv/lighttpd-main/。它由以下目录和文件组成

/srv/lighttpd-main/           # the service directory
/srv/lighttpd-main/run        # the script that starts lighttpd
/srv/lighttpd-main/root/      # lighttpd configuration files go here
/srv/lighttpd-main/log/       # the service directory for the logger
/srv/lighttpd-main/log/run    # the script that starts the logger
/srv/lighttpd-main/log/main/  # log files go here

如果您正在使用 Gentoo,请使用 /var/services 而不是 /srv

注意:"./root/" 目录是可选的,可以命名为任何名称,我们在这里使用它仅仅是为了有一个地方来放置配置文件(我们将配置分解为多个文件并使用 include 语句)。

文件 ./run

#! /bin/sh

exec 2>&1
exec lighttpd -D -f ./root/lighttpd.conf

文件 ./root/lighttpd.conf

除了您的特定设置之外,您可能还希望包含以下定义

server.pid-file = "./root/lighttpd.pid" 
#server.errorlog must be NOT be set

文件 ./log/run

#! /bin/sh

umask 0027
exec setuidgid nobody multilog ./main

目录 ./log/main/

指定运行 multilog 的用户(在上述示例中为 nobody)必须对此目录具有写入权限

chown nobody ./log/main/


配置文件到位后,只需在 svscan 服务目录中放置一个软链接(在 DJB 的示例中为 /service)

ln -s /srv/lighttpd-main /service/

(如果您在此处感到困惑,请访问 Wayne Marshall 的概述)。

这就是您开始所需的一切。

另请参阅 LighttpdUnderSuperviseExampleConfiguration

Runit

另请参阅 HowToRunLightyWithRunit(用于平滑重启包装器)

更新者 stbuehler 大约 13 年前 · 11 次修订