diff --git a/UPDATING b/UPDATING index b6baa1862d8e..e6745c8027c6 100644 --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,18 @@ they are unavoidable. You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +20100818: + AFFECTS: users of www/lighttpd + AUTHOR: mm@FreeBSD.org + + The default lighttpd configuration file locations have changed. + The main configuration file is now: $PREFIX/etc/lighttpd/lighttpd.conf + and includes other configuration files from $PREFIX/etc/lighttpd/ + + For compatibility with old-style configurations, if the lighttpd_conf + variable is not set in /etc/rc.conf, $PREFIX/etc/lighttpd.conf takes + precedence over $PREFIX/etc/lighttpd/lighttpd.conf + 20100815: AFFECTS: users of databases/redis and databases/redis-devel AUTHOR: osa@FreeBSD.org diff --git a/www/lighttpd/Makefile b/www/lighttpd/Makefile index 3a3cdd41e914..7f8ffd5070e8 100644 --- a/www/lighttpd/Makefile +++ b/www/lighttpd/Makefile @@ -7,7 +7,7 @@ PORTNAME= lighttpd PORTVERSION= 1.4.27 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= www MASTER_SITES= http://download.lighttpd.net/lighttpd/releases-1.4.x/ @@ -51,6 +51,27 @@ OPTIONS= BZIP2 "Enable Bzip2 support" off \ PORTDOCS= AUTHORS COPYING INSTALL NEWS README .endif +CONF_FILES= lighttpd.conf modules.conf + +CONFD_FILES= access_log.conf auth.conf cgi.conf cml.conf \ + compress.conf debug.conf dirlisting.conf \ + evhost.conf expire.conf fastcgi.conf geoip.conf \ + magnet.conf mime.conf mysql_vhost.conf proxy.conf \ + rrdtool.conf scgi.conf secdownload.conf \ + simple_vhost.conf ssi.conf status.conf \ + trigger_b4_dl.conf userdir.conf webdav.conf + +LIGHTTPD_LOGROOT?= /var/log/lighttpd +LIGHTTPD_WEBROOT?= ${PREFIX}/www/data +LIGHTTPD_USER?= www +LIGHTTPD_GROUP?= www + +PLIST_SUB+= LOGROOT="${LIGHTTPD_LOGROOT}" \ + USER="${LIGHTTPD_USER}" \ + GROUP="${LIGHTTPD_GROUP}" \ + MKDIR="${MKDIR}" \ + CHOWN="${CHOWN}" + .include # Default REQUIRE to rc.d script @@ -164,39 +185,54 @@ CONFIGURE_ARGS+= --with-webdav-props --with-webdav-locks SUB_LIST+= REQUIRE="${_REQUIRE}" post-patch: - @${REINPLACE_CMD} -e 's|-std=gnu99||' ${WRKSRC}/configure ${WRKSRC}/configure.ac - @${REINPLACE_CMD} -E -e 's|(server.document-root.*=).*|\1 "${PREFIX}/www/data/"|' \ - -e 's|(server.errorlog.*=).*|\1 "/var/log/lighttpd.error.log"|' \ - -e 's|# server.event-handler|server.event-handler|' \ - -e 's|(accesslog.filename.*=).*|\1 "/var/log/lighttpd.access.log"|' \ - -e 's|#server.pid-file|server.pid-file|' \ - -e 's|#server.username.*|server.username = "www"|' \ - -e 's|#server.groupname.*|server.groupname = "www"|' \ - -e 's|/usr/local/bin/php|${PREFIX}/bin/php-cgi|' \ - ${WRKSRC}/doc/config/lighttpd.conf + @${REINPLACE_CMD} -e 's|-std=gnu99||' \ + ${WRKSRC}/configure ${WRKSRC}/configure.ac + @${REINPLACE_CMD} -E -e \ + 's|^(server.document-root.*=).*|\1 "${PREFIX}/www/data/"|' \ + -e "s|/etc/lighttpd|${PREFIX}/etc/lighttpd|g" \ + -e 's|^(server.event-handler.*=).*|\1 "freebsd-kqueue"|' \ + -e 's|^(server.network-backend.*=).*|\1 "writev"|' \ + -e "s|^(server.username.*=).*|\1 \"${LIGHTTPD_USER}\"|" \ + -e "s|^(server.groupname.*=).*|\1 \"${LIGHTTPD_GROUP}\"|" \ + -e "s|^(var.log_root.*=).*|\1 \"${LIGHTTPD_LOGROOT}\"|" \ + -e "s|^(var.home_dir.*=).*|\1 \"/var/spool/lighttpd\"|" \ + -e "s|^(var.server_root.*=).*|\1 \"${LIGHTTPD_WEBROOT}\"|" \ + ${WRKSRC}/doc/config/lighttpd.conf + @${REINPLACE_CMD} -e "s|/etc/lighttpd|${PREFIX}/etc/lighttpd|g" \ + ${WRKSRC}/doc/config/conf.d/auth.conf @${ECHO} >> ${WRKSRC}/doc/config/lighttpd.conf - @${ECHO} "# IPv4 listening socket" >> ${WRKSRC}/doc/lighttpd.conf >> \ + @${ECHO} "# IPv4 listening socket" >> \ ${WRKSRC}/doc/config/lighttpd.conf @${ECHO} "\$$SERVER[\"socket\"] == \"0.0.0.0:80\" { }" >> \ ${WRKSRC}/doc/config/lighttpd.conf -.if !defined(WITHOUT_IPV6) - @${ECHO} >> ${WRKSRC}/doc/config/lighttpd.conf - @${ECHO} "# IPv6 listening socket" >> ${WRKSRC}/doc/lighttpd.conf >> \ - ${WRKSRC}/doc/config/lighttpd.conf - @${ECHO} "\$$SERVER[\"socket\"] == \"[::]:80\" { }" >> \ - ${WRKSRC}/doc/config/lighttpd.conf -.endif .if defined(WITH_H264) @${CAT} ${WRKSRC}/COPYING_H264 @sleep 10 .endif post-install: - @${INSTALL_DATA} ${WRKSRC}/doc/config/lighttpd.conf ${PREFIX}/etc/lighttpd.conf.sample -.if !exists(${PREFIX}/etc/lighttpd.conf) - @${INSTALL_DATA} ${WRKSRC}/doc/config/lighttpd.conf ${PREFIX}/etc/lighttpd.conf + @${MKDIR} ${PREFIX}/etc/lighttpd/conf.d ${PREFIX}/etc/lighttpd/vhosts.d +.for FILE in ${CONF_FILES} + @${INSTALL_DATA} ${WRKSRC}/doc/config/${FILE} \ + ${PREFIX}/etc/lighttpd/${FILE}.sample +.if !exists(${PREFIX}/etc/lighttpd/${FILE}) + @${INSTALL_DATA} ${WRKSRC}/doc/config/${FILE} \ + ${PREFIX}/etc/lighttpd/${FILE} .endif - @${LIBTOOL} --finish ${PREFIX}/lib +.endfor +.for FILE in ${CONFD_FILES} + @${INSTALL_DATA} ${WRKSRC}/doc/config/conf.d/${FILE} \ + ${PREFIX}/etc/lighttpd/conf.d/${FILE}.sample +.if !exists(${PREFIX}/etc/lighttpd/conf.d/${FILE}) + @${INSTALL_DATA} ${WRKSRC}/doc/config/conf.d/${FILE} \ + ${PREFIX}/etc/lighttpd/conf.d/${FILE} +.endif +.endfor + @${INSTALL_DATA} ${WRKSRC}/doc/config/vhosts.d/vhosts.template \ + ${PREFIX}/etc/lighttpd/vhosts.d/vhosts.template + @${MKDIR} -m 0700 ${LIGHTTPD_LOGROOT} + @${CHOWN} ${LIGHTTPD_USER}:${LIGHTTPD_GROUP} ${LIGHTTPD_LOGROOT} + .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} . for FILE in ${PORTDOCS} diff --git a/www/lighttpd/files/lighttpd.sh.in b/www/lighttpd/files/lighttpd.sh.in index dca9319f5103..f87920716dee 100644 --- a/www/lighttpd/files/lighttpd.sh.in +++ b/www/lighttpd/files/lighttpd.sh.in @@ -11,7 +11,7 @@ # lighttpd_enable (bool): Set it to "YES" to enable lighttpd # Default is "NO". # lighttpd_conf (path): Set full path to config file. -# Default is "%%PREFIX%%/etc/lighttpd.conf". +# Default is "%%PREFIX%%/etc/lighttpd/lighttpd.conf". # lighttpd_pidfile (path): Set full path to pid file. # Default is "/var/run/lighttpd.pid". # @@ -24,13 +24,25 @@ rcvar=`set_rcvar` load_rc_config $name : ${lighttpd_enable="NO"} -: ${lighttpd_conf="%%PREFIX%%/etc/lighttpd.conf"} +: ${lighttpd_conf=""} : ${lighttpd_pidfile="/var/run/${name}.pid"} +# Compatibility for old configuration file location +deprecated_conf= +if [ -z "${lighttpd_conf}" ]; then + if [ -f "%%PREFIX%%/etc/lighttpd.conf" ]; then + deprecated_conf=1 + lighttpd_conf="%%PREFIX%%/etc/lighttpd.conf" + else + lighttpd_conf="%%PREFIX%%/etc/lighttpd/lighttpd.conf" + fi +fi + command=%%PREFIX%%/sbin/lighttpd command_args="-f ${lighttpd_conf}" pidfile=${lighttpd_pidfile} required_files=${lighttpd_conf} +start_precmd="check_deprecated" stop_postcmd=stop_postcmd restart_precmd="checkconfig" reload_precmd=reload_precmd @@ -39,6 +51,17 @@ sig_reload="INT" check_cmd="checkconfig" extra_commands="reload check" +check_deprecated() +{ + if [ -n "${deprecated_conf}" ]; then + echo "" + echo "*** NOTICE: ***" + echo "The default location of %%PREFIX%%/etc/lighttpd.conf is deprecated" + echo "Please consider moving to %%PREFIX%%/etc/lighttpd/lighttpd.conf" + echo "" + fi +} + checkconfig() { echo "Performing sanity check on ${name} configuration:" @@ -52,7 +75,11 @@ stop_postcmd() reload_precmd() { - echo "Stoping ${name} and start gracefully." + if checkconfig; then + echo "Performing a graceful restart" + else + return 1 + fi } reload_postcmd() diff --git a/www/lighttpd/pkg-plist b/www/lighttpd/pkg-plist index 9d3667a41f66..bdf573c3f2a2 100644 --- a/www/lighttpd/pkg-plist +++ b/www/lighttpd/pkg-plist @@ -1,7 +1,83 @@ @comment $FreeBSD$ -@unexec if cmp -s %D/etc/lighttpd.conf %D/etc/lighttpd.conf.sample; then rm -f %D/etc/lighttpd.conf; fi -etc/lighttpd.conf.sample +@unexec if cmp -s %D/etc/lighttpd/lighttpd.conf %D/etc/lighttpd/lighttpd.conf.sample; then rm -f %D/etc/lighttpd/lighttpd.conf; fi +etc/lighttpd/lighttpd.conf.sample @exec [ -f %B/lighttpd.conf ] || cp %B/%f %B/lighttpd.conf +@unexec if cmp -s %D/etc/lighttpd/modules.conf %D/etc/lighttpd/modules.conf.sample; then rm -f %D/etc/lighttpd/modules.conf; fi +etc/lighttpd/modules.conf.sample +@exec [ -f %B/modules.conf ] || cp %B/%f %B/modules.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/access_log.conf %D/etc/lighttpd/conf.d/access_log.conf.sample; then rm -f %D/etc/lighttpd/conf.d/access_log.conf; fi +etc/lighttpd/conf.d/access_log.conf.sample +@exec [ -f %B/access_log.conf ] || cp %B/%f %B/access_log.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/auth.conf %D/etc/lighttpd/conf.d/auth.conf.sample; then rm -f %D/etc/lighttpd/conf.d/auth.conf; fi +etc/lighttpd/conf.d/auth.conf.sample +@exec [ -f %B/auth.conf ] || cp %B/%f %B/auth.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/cgi.conf %D/etc/lighttpd/conf.d/cgi.conf.sample; then rm -f %D/etc/lighttpd/conf.d/cgi.conf; fi +etc/lighttpd/conf.d/cgi.conf.sample +@exec [ -f %B/cgi.conf ] || cp %B/%f %B/cgi.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/cml.conf %D/etc/lighttpd/conf.d/cml.conf.sample; then rm -f %D/etc/lighttpd/conf.d/cml.conf; fi +etc/lighttpd/conf.d/cml.conf.sample +@exec [ -f %B/cml.conf ] || cp %B/%f %B/cml.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/compress.conf %D/etc/lighttpd/conf.d/compress.conf.sample; then rm -f %D/etc/lighttpd/conf.d/compress.conf; fi +etc/lighttpd/conf.d/compress.conf.sample +@exec [ -f %B/compress.conf ] || cp %B/%f %B/compress.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/debug.conf %D/etc/lighttpd/conf.d/debug.conf.sample; then rm -f %D/etc/lighttpd/conf.d/debug.conf; fi +etc/lighttpd/conf.d/debug.conf.sample +@exec [ -f %B/debug.conf ] || cp %B/%f %B/debug.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/dirlisting.conf %D/etc/lighttpd/conf.d/dirlisting.conf.sample; then rm -f %D/etc/lighttpd/conf.d/dirlisting.conf; fi +etc/lighttpd/conf.d/dirlisting.conf.sample +@exec [ -f %B/dirlisting.conf ] || cp %B/%f %B/dirlisting.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/evhost.conf %D/etc/lighttpd/conf.d/evhost.conf.sample; then rm -f %D/etc/lighttpd/conf.d/evhost.conf; fi +etc/lighttpd/conf.d/evhost.conf.sample +@exec [ -f %B/evhost.conf ] || cp %B/%f %B/evhost.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/expire.conf %D/etc/lighttpd/conf.d/expire.conf.sample; then rm -f %D/etc/lighttpd/conf.d/expire.conf; fi +etc/lighttpd/conf.d/expire.conf.sample +@exec [ -f %B/expire.conf ] || cp %B/%f %B/expire.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/fastcgi.conf %D/etc/lighttpd/conf.d/fastcgi.conf.sample; then rm -f %D/etc/lighttpd/conf.d/fastcgi.conf; fi +etc/lighttpd/conf.d/fastcgi.conf.sample +@exec [ -f %B/fastcgi.conf ] || cp %B/%f %B/fastcgi.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/geoip.conf %D/etc/lighttpd/conf.d/geoip.conf.sample; then rm -f %D/etc/lighttpd/conf.d/geoip.conf; fi +etc/lighttpd/conf.d/geoip.conf.sample +@exec [ -f %B/geoip.conf ] || cp %B/%f %B/geoip.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/magnet.conf %D/etc/lighttpd/conf.d/magnet.conf.sample; then rm -f %D/etc/lighttpd/conf.d/magnet.conf; fi +etc/lighttpd/conf.d/magnet.conf.sample +@exec [ -f %B/magnet.conf ] || cp %B/%f %B/magnet.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/mime.conf %D/etc/lighttpd/conf.d/mime.conf.sample; then rm -f %D/etc/lighttpd/conf.d/mime.conf; fi +etc/lighttpd/conf.d/mime.conf.sample +@exec [ -f %B/mime.conf ] || cp %B/%f %B/mime.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/mysql_vhost.conf %D/etc/lighttpd/conf.d/mysql_vhost.conf.sample; then rm -f %D/etc/lighttpd/conf.d/mysql_vhost.conf; fi +etc/lighttpd/conf.d/mysql_vhost.conf.sample +@exec [ -f %B/mysql_vhost.conf ] || cp %B/%f %B/mysql_vhost.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/proxy.conf %D/etc/lighttpd/conf.d/proxy.conf.sample; then rm -f %D/etc/lighttpd/conf.d/proxy.conf; fi +etc/lighttpd/conf.d/proxy.conf.sample +@exec [ -f %B/proxy.conf ] || cp %B/%f %B/proxy.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/rrdtool.conf %D/etc/lighttpd/conf.d/rrdtool.conf.sample; then rm -f %D/etc/lighttpd/conf.d/rrdtool.conf; fi +etc/lighttpd/conf.d/rrdtool.conf.sample +@exec [ -f %B/rrdtool.conf ] || cp %B/%f %B/rrdtool.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/scgi.conf %D/etc/lighttpd/conf.d/scgi.conf.sample; then rm -f %D/etc/lighttpd/conf.d/scgi.conf; fi +etc/lighttpd/conf.d/scgi.conf.sample +@exec [ -f %B/scgi.conf ] || cp %B/%f %B/scgi.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/secdownload.conf %D/etc/lighttpd/conf.d/secdownload.conf.sample; then rm -f %D/etc/lighttpd/conf.d/secdownload.conf; fi +etc/lighttpd/conf.d/secdownload.conf.sample +@exec [ -f %B/secdownload.conf ] || cp %B/%f %B/secdownload.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/simple_vhost.conf %D/etc/lighttpd/conf.d/simple_vhost.conf.sample; then rm -f %D/etc/lighttpd/conf.d/simple_vhost.conf; fi +etc/lighttpd/conf.d/simple_vhost.conf.sample +@exec [ -f %B/simple_vhost.conf ] || cp %B/%f %B/simple_vhost.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/ssi.conf %D/etc/lighttpd/conf.d/ssi.conf.sample; then rm -f %D/etc/lighttpd/conf.d/ssi.conf; fi +etc/lighttpd/conf.d/ssi.conf.sample +@exec [ -f %B/ssi.conf ] || cp %B/%f %B/ssi.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/status.conf %D/etc/lighttpd/conf.d/status.conf.sample; then rm -f %D/etc/lighttpd/conf.d/status.conf; fi +etc/lighttpd/conf.d/status.conf.sample +@exec [ -f %B/status.conf ] || cp %B/%f %B/status.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/trigger_b4_dl.conf %D/etc/lighttpd/conf.d/trigger_b4_dl.conf.sample; then rm -f %D/etc/lighttpd/conf.d/trigger_b4_dl.conf; fi +etc/lighttpd/conf.d/trigger_b4_dl.conf.sample +@exec [ -f %B/trigger_b4_dl.conf ] || cp %B/%f %B/trigger_b4_dl.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/userdir.conf %D/etc/lighttpd/conf.d/userdir.conf.sample; then rm -f %D/etc/lighttpd/conf.d/userdir.conf; fi +etc/lighttpd/conf.d/userdir.conf.sample +@exec [ -f %B/userdir.conf ] || cp %B/%f %B/userdir.conf +@unexec if cmp -s %D/etc/lighttpd/conf.d/webdav.conf %D/etc/lighttpd/conf.d/webdav.conf.sample; then rm -f %D/etc/lighttpd/conf.d/webdav.conf; fi +etc/lighttpd/conf.d/webdav.conf.sample +@exec [ -f %B/webdav.conf ] || cp %B/%f %B/webdav.conf +etc/lighttpd/vhosts.d/vhosts.template lib/lighttpd/mod_access.a lib/lighttpd/mod_access.la lib/lighttpd/mod_access.so @@ -107,3 +183,10 @@ lib/lighttpd/mod_webdav.so sbin/lighttpd sbin/lighttpd-angel @dirrm lib/lighttpd +@dirrmtry etc/lighttpd/vhosts.d +@dirrmtry etc/lighttpd/conf.d +@dirrmtry etc/lighttpd +@cwd / +@exec %%MKDIR%% -m 0700 %%LOGROOT%% +@exec %%CHOWN%% %%USER%%:%%GROUP%% %%LOGROOT%% +@dirrmtry %%LOGROOT%%