I needed to run multiple instances of lighttpd, and here's how I did it: copy /etc/lighttpd.conf to /etc/lighttpd2.conf copy /etc/init.d/lighttpd to /etc/init.d/lighttpd2 I had to modify the init script to use --pidfile ${PID_FILE} in order to get the behavior I wanted (otherwise, it would tries to kill the process by the executable name, not the PID). In my eyes, it really just makes more sense to use the PID file if we have it since it's more specific than killing per executable name. Reproducible: Always Steps to Reproduce: 1. 2. 3.
I am having trouble getting start-stop-daemon to work with lighttpd/pid files... I think when lighttpd daemonizes, start-stop-daemon doesn't get returned the pid (so I have empty pid files). Does anyone know why this is happening and if there's a better way to have init scripts control multiple lighttpd processes?
Solution: set the server.pid-file variable in each lighttpd.conf you use... Then lighty will write its own pids, and start-stop-daemon will be able to kill it via --pidfile
yes - as you say. set an appropriate value of server.pid-file in each config file - copy the init script to use the new pid- and config-file. closing the bug. please reopen if you meant something else.
I was wanting to have multiple instances of lighttpd as well. I think that a note should be placed in the init script noting that the pid file should match the pid file in the lighttpd config. In my opinion, a better solution would be to give the --make-pidfile argument to start-stop-daemon. This would create the wanted pidfile. The problem with this is that when lighttpd daemonizes itself the pid of the server process changes. So giving -D (don't daemonize) to lighttpd and --background to start-stop-daemon gives the correct pid. start-stop-daemon --start --quiet --background \ --pidfile ${LIGHTTPD_PID} --make-pidfile \ --exec /usr/sbin/lighttpd -- -D -f ${LIGHTTPD_CONF} That is the only change that would be made to the init script. Then the pid file can be removed from lighttpd.conf.
I agree. As a webserver, lighttpd is basic systems infrastructure. Not elegantly supporting multiple instances out of the box is a bad thing. In my case, I wanted multiple instances for testing purposes. Manual modification to support this should be minimised by improving the init script as Eric suggested. I don't think it's right to mark this bug as 'RESOLVED WORKSFORME'.