LighttpdUnderSupervise » History » Revision 5
Revision 4 (moo, 2006-05-23 03:19) → Revision 5/11 (moo, 2006-05-23 06:12)
= 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 }}} If you're using [http://gentoo.org Gentoo], use /var/services instead of /var 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 #!ksh #! /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 #!ksh #! /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 # 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.