Project

General

Profile

Actions

LighttpdUnderSupervise » History » Revision 1

Revision 1/11 | Next »
Anonymous, 2005-12-04 19:01


= Running Lighttpd under daemontools/supervise =

Lighttpd is well suited to run moitored by the "supervise" program from Daniel J. Bernsteins [http://cr.yp.to/daemontools.html daemontools] package.

To set it up, you must first create a standard service directory structure. In the following example the service directory from where the process starts will be /srv/lighttpd-main/. It consists of the following directory and files: {{{
/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
}}}

Note: the "./root/" directory is optional and could be called anything, and we use it here simply to have somewhere to put the configuration file''s'' (we chop up the configuration into several files and use the ''include'' statement).

When the configuration file is in place, just place a symlink into the svscan service directory (/service in DJB's examples):

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

(Please visit [http://thedjbway.org/daemontools.html Wayne Marshalls overview] in case you're lost at this point).

File ./run {{{
#! /bin/sh

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

File ./root/lighttpd.conf

Apart from your specific settings you probably want to include the following definitions: {{{
server.pid-file = "./root/lighttpd.pid"
#server.errorlog must be NOT be set
}}}

File ./log/run {{{
#! /bin/sh

umask 0027
exec setuidgid nobody multilog ./main
}}}

File ./log/main/
The user that is specified to run multilog (''nobody'' in the above example) must have write access to this directory: {{{
chown nobody ./log/main/
}}}

Updated by Anonymous over 18 years ago · 1 revisions