--- /dev/null
+#!/bin/sh
+
+# lighttpd
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+log_script_name "$0 $*"
+
+# Check for missing binaries (stale symlinks should not happen)
+LIGHTTPD_BIN=/usr/sbin/lighttpd
+
+if [ ! -x ${LIGHTTPD_BIN} ]; then
+ log_message "*** ERROR: ${LIGHTTPD_BIN} program not found."
+ exit ${EXIT_CODE_FAILURE}
+fi
+
+# Check for existence of needed config file and read it
+LIGHTTPD_CONFIG=/etc/sysconfig/lighttpd
+if [ ! -r ${LIGHTTPD_CONFIG} ]; then
+ log_message "*** ERROR: ${LIGHTTPD_CONFIG} not found."
+ exit ${EXIT_CODE_FAILURE}
+fi
+
+. $LIGHTTPD_CONFIG
+
+case "$1" in
+ start)
+ cmd_run_log_box "Starting Lighttpd server" \
+ ${LIGHTTPD_BIN} -f ${LIGHTTPD_CONF_PATH}
+ ;;
+
+ stop)
+ cmd_run_log_box "Stopping Lighttpd server" killproc ${LIGHTTPD_BIN}
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ status)
+ statusproc ${LIGHTTPD_BIN}
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit ${EXIT_CODE_FAILURE}
+ ;;
+
+esac
+
+exit $?
--- /dev/null
+#!/bin/bash
+
+hvconfig_pre()
+{
+ groupadd -f ${APACHE_USER}
+ hv_useradd -c WebServer -d /dev/null -g ${APACHE_USER} -s /bin/false \
+ ${APACHE_USER}
+}
+
+hvbuild_post()
+{
+ cd ${LFS_TMP}/${PACKAGE}
+
+ install -dv \
+ /etc/lighttpd \
+ /var/log/lighttpd \
+ /var/lib/lighttpd \
+ /var/lib/lighttpd/sockets \
+ /var/cache/lighttpd
+
+ cp -R doc/config/conf.d/ doc/config/*.conf doc/config/vhosts.d/ \
+ /etc/lighttpd/
+
+ chown -R www.www \
+ /etc/lighttpd \
+ /var/log/lighttpd \
+ /var/lib/lighttpd \
+ /var/lib/lighttpd/sockets \
+ /var/cache/lighttpd
+
+ # Modifying the configuration file to run the server as a dedicated user:
+ sed -i \
+ -e "s!^\(server\.username\).*!\1 = \"www\"!" \
+ -e "s!^\(server\.groupname\).*!\1 = \"www\"!" \
+ /etc/lighttpd/lighttpd.conf
+
+ # Disable IPV6
+ sed -i \
+ -e "s!^\(server\.use-ipv6\).*!\1 = \"disable\"!" \
+ /etc/lighttpd/lighttpd.conf
+
+ # Enable fastgcgi module
+ sed -i \
+ -e "s!^#\(include \"conf\.d/fastcgi\.conf\"\).*!\1!" \
+ /etc/lighttpd/modules.conf
+
+
+ # astcgi config
+ cat > /etc/lighttpd/conf.d/fastcgi.conf << "EOF" &&
+server.modules += ( "mod_fastcgi" )
+
+fastcgi.server = ( ".php" => ((
+ "bin-path" => "/usr/bin/php-cgi",
+ "socket" => socket_dir + "/php-fastcgi.socket"
+ )))
+EOF
+
+ chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/www
+
+ # Bootscript
+ cp -p doc/initscripts/sysconfig.lighttpd /etc/sysconfig/lighttpd
+
+ install -v -m740 ${SCRDIR}/bootscripts/lighttpd /etc/rc.d/init.d
+
+ # script-name start stop
+ bootscript_add_rc3 lighttpd 70 20
+}