LighttpdUnderSupervise » History » Revision 9
Revision 8 (zikzik, 2007-01-16 01:03) → Revision 9/11 (zikzik, 2007-01-16 01:03)
h1. = Running Lighttpd under daemontools/supervise = Lighttpd is well suited to run monitored by the "supervise" program from Daniel J. Bernstein's "daemontools":http://cr.yp.to/daemontools.html [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: <pre> {{{ /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 </pre> }}} If you're using "Gentoo":http://gentoo.org, [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_ file''s'' (we chop up the configuration into several files and use the _include_ ''include'' statement). h2. == File ./run <pre> == {{{ #!sh #! /bin/sh exec 2>&1 exec lighttpd -D -f ./root/lighttpd.conf </pre> h2. }}} == File ./root/lighttpd.conf == Apart from your specific settings you probably want to include the following definitions: <pre> {{{ server.pid-file = "./root/lighttpd.pid" #server.errorlog must be NOT be set </pre> h2. }}} == File ./log/run <pre> == {{{ #!sh #! /bin/sh umask 0027 exec setuidgid nobody multilog ./main </pre> h2. }}} == Directory ./log/main/ == The user that is specified to run multilog (_nobody_ (''nobody'' in the above example) must have write access to this directory: <pre> {{{ #!ShellExample # chown nobody ./log/main/ </pre> }}} ---- After the configuration file is in place, just place a symlink into the svscan service directory (/service in DJB's examples): <pre> {{{ #!ShellExample # ln -s /srv/lighttpd-main /service/ </pre> }}} (Please visit "Wayne [http://thedjbway.org/daemontools.html Wayne Marshalls overview":http://thedjbway.org/daemontools.html overview] in case you're lost at this point). That's all you need to get started. See also LighttpdUnderSuperviseExampleConfiguration. h2. == Runit == See also HowToRunLightyWithRunit (for graceful restart wrapper)