Project

General

Profile

Actions

LighttpdUnderSupervise » History » Revision 8

« Previous | Revision 8/11 (diff) | Next »
zikzik, 2007-01-16 01:03


= Running Lighttpd under daemontools/supervise =

Lighttpd is well suited to run monitored by the "supervise" program from Daniel J. Bernstein's [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
}}}

If you're using [http://gentoo.org Gentoo], use /var/services instead of /srv

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

File ./run {{{
#!sh
#! /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 {{{
#!sh
#! /bin/sh

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

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

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

{{{
#!ShellExample
  1. ln -s /srv/lighttpd-main /service/
    }}}

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

That's all you need to get started.

See also LighttpdUnderSuperviseExampleConfiguration.

Runit

See also HowToRunLightyWithRunit
(for graceful restart wrapper)

Updated by zikzik about 17 years ago · 8 revisions