diff --git a/www-servers/lighttpd/additional-files/create-lighttpd-directories.sh b/www-servers/lighttpd/additional-files/create-lighttpd-directories.sh index c05896515..788c2028b 100755 --- a/www-servers/lighttpd/additional-files/create-lighttpd-directories.sh +++ b/www-servers/lighttpd/additional-files/create-lighttpd-directories.sh @@ -11,3 +11,4 @@ if [ ! -e var/www/htdocs/index.lighttpd.html ]; then fi mkdir -p var/log/lighttpd var/lib/lighttpd var/cache/lighttpd var/tmp/lighttpd +mkdir -p var/run diff --git a/www-servers/lighttpd/additional-files/geoip.shtml b/www-servers/lighttpd/additional-files/geoip.shtml new file mode 100644 index 000000000..06590c195 --- /dev/null +++ b/www-servers/lighttpd/additional-files/geoip.shtml @@ -0,0 +1,22 @@ + + + +GeoIP + + + +
+ + + + + + + + + +
GeoIP data for
GEOIP_COUNTRY_CODE
GEOIP_COUNTRY_CODE3
GEOIP_COUNTRY_NAME
GEOIP_CITY_NAME
GEOIP_CITY_POSTAL_CODE
GEOIP_CITY_LATITUDE
GEOIP_CITY_LONG_LATITUDE
GEOIP_CITY_DMA_CODE
GEOIP_CITY_AREA_CODE
+
GeoIP databases from http://maxmind.com/
+ + diff --git a/www-servers/lighttpd/additional-files/quickstart-geoip.txt b/www-servers/lighttpd/additional-files/quickstart-geoip.txt new file mode 100644 index 000000000..7593e13b3 --- /dev/null +++ b/www-servers/lighttpd/additional-files/quickstart-geoip.txt @@ -0,0 +1,20 @@ +A GeoIP module is officialy included in lighttpd since release 1.4.42. +To use it you have to download the GeoIP.dat or GeoLiteCity.dat databases from +http://maxmind.com/ +You can do so manually, or with the geoipupdate command from the geoipupdate +package or the geoipupdate.sh script from the geoip package (which provides the +libGeoIP.so shared library needed by mod_geoip.) + +You will also need to edit /system/settings/lighttpd/conf.d/geoip.conf to +uncomment the line with the geoip.db-filename parameter. +Finally, you will need to edit /system/settings/lighttpd/modules.conf to +enable mod_geoip by uncommenting the line with the following directive: +include "conf.d/geoip.conf" + +A demo geoip page is /system/data/www/htdocs/geoip/index.lighttpd.shtml +and can be accessed by pointing your browser to http://yourserver/geoip/ + +Reminder: GeoIP data is not available for private network addresses as defined +in rfc1918 (e.g. 192.168.x.y) so you won't see any GeoIP data unless you access +your web server from a public IPv4 address. +Warning: You should only expose your web server if you know what you are doing. diff --git a/www-servers/lighttpd/additional-files/quickstart.txt b/www-servers/lighttpd/additional-files/quickstart.txt index af7af8ed6..208a88317 100644 --- a/www-servers/lighttpd/additional-files/quickstart.txt +++ b/www-servers/lighttpd/additional-files/quickstart.txt @@ -8,4 +8,4 @@ With the default configuration, access.log and error.log live in /var/log/lightt lighttpd can be started with: lighttpd -f /system/settings/lighttpd/lighttpd.conf and stopped with: - kill $(cat /var/lighttpd.pid) + kill $(cat /var/run/lighttpd.pid) diff --git a/www-servers/lighttpd/lighttpd-1.4.41.recipe b/www-servers/lighttpd/lighttpd-1.4.42.recipe similarity index 77% rename from www-servers/lighttpd/lighttpd-1.4.41.recipe rename to www-servers/lighttpd/lighttpd-1.4.42.recipe index 6038c25de..6ba5a608b 100644 --- a/www-servers/lighttpd/lighttpd-1.4.41.recipe +++ b/www-servers/lighttpd/lighttpd-1.4.42.recipe @@ -10,12 +10,14 @@ HOMEPAGE="https://www.lighttpd.net/" COPYRIGHT="2003-2016 Jan Kneschke" LICENSE="BSD (3-clause)" REVISION="1" -SOURCE_URI="https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-$portVersion.tar.gz" -CHECKSUM_SHA256="8a5749e218237fafc3119dd8a4fcf510ea728728b3fcf1193fcad7209be4b6d7" +SOURCE_URI="https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-$portVersion.tar.xz" +CHECKSUM_SHA256="b2c9069ed0bade9362c27b469a9b884641786aea1c3d686f9fd9f01d15e2a15f" ADDITIONAL_FILES=" create-lighttpd-directories.sh index.template + geoip.shtml quickstart.txt + quickstart-geoip.txt " ARCHITECTURES="!x86_gcc2 x86 x86_64 ?arm ?ppc" @@ -35,9 +37,14 @@ PROVIDES=" lib:mod_accesslog lib:mod_alias lib:mod_auth + lib:mod_authn_file + lib:mod_authn_gssapi + lib:mod_authn_ldap + lib:mod_authn_mysql lib:mod_cgi lib:mod_cml lib:mod_compress + lib:mod_deflate lib:mod_dirlisting lib:mod_evasive lib:mod_evhost @@ -60,6 +67,7 @@ PROVIDES=" lib:mod_staticfile lib:mod_status lib:mod_trigger_b4_dl + lib:mod_uploadprogress lib:mod_userdir lib:mod_usertrack lib:mod_webdav @@ -78,6 +86,15 @@ REQUIRES=" lib:libz$secondaryArchSuffix " +PROVIDES_mod_geoip=" + lighttpd${secondaryArchSuffix}_mod_geoip = $portVersion + lib:mod_geoip + " +REQUIRES_mod_geoip=" + lighttpd$secondaryArchSuffix == $portVersion base + lib:libGeoIP$secondaryArchSuffix + " + PROVIDES_devel=" lighttpd${secondaryArchSuffix}_devel = $portVersion " @@ -89,6 +106,7 @@ BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel devel:libbz2$secondaryArchSuffix devel:libcrypto$secondaryArchSuffix + devel:libGeoIP$secondaryArchSuffix devel:libldap$secondaryArchSuffix devel:liblua$secondaryArchSuffix devel:libpcre$secondaryArchSuffix @@ -126,7 +144,6 @@ GLOBAL_WRITABLE_FILES=" settings/lighttpd/conf.d/evhost.conf keep-old settings/lighttpd/conf.d/expire.conf keep-old settings/lighttpd/conf.d/fastcgi.conf keep-old - settings/lighttpd/conf.d/geoip.conf keep-old settings/lighttpd/conf.d/magnet.conf keep-old settings/lighttpd/conf.d/mime.conf keep-old settings/lighttpd/conf.d/mysql_vhost.conf keep-old @@ -142,6 +159,10 @@ GLOBAL_WRITABLE_FILES=" settings/lighttpd/conf.d/webdav.conf keep-old " +GLOBAL_WRITABLE_FILES_mod_geoip=" + settings/lighttpd/conf.d/geoip.conf keep-old + " + USER_SETTINGS_FILES=" settings/lighttpd directory settings/lighttpd/conf.d directory @@ -157,7 +178,6 @@ USER_SETTINGS_FILES=" settings/lighttpd/conf.d/evhost.conf template data/lighttpd/template-settings/conf.d/evhost.conf settings/lighttpd/conf.d/expire.conf template data/lighttpd/template-settings/conf.d/expire.conf settings/lighttpd/conf.d/fastcgi.conf template data/lighttpd/template-settings/conf.d/fastcgi.conf - settings/lighttpd/conf.d/geoip.conf template data/lighttpd/template-settings/conf.d/geoip.conf settings/lighttpd/conf.d/magnet.conf template data/lighttpd/template-settings/conf.d/magnet.conf settings/lighttpd/conf.d/mime.conf template data/lighttpd/template-settings/conf.d/mime.conf settings/lighttpd/conf.d/mysql_vhost.conf template data/lighttpd/template-settings/conf.d/mysql_vhost.conf @@ -173,6 +193,10 @@ USER_SETTINGS_FILES=" settings/lighttpd/conf.d/webdav.conf template data/lighttpd/template-settings/conf.d/webdav.conf " +USER_SETTINGS_FILES_mod_geoip=" + settings/lighttpd/conf.d/geoip.conf template data/lighttpd/template-settings/conf.d/geoip.conf + " + POST_INSTALL_SCRIPTS=" $relativePostInstallDir/create-lighttpd-directories.sh " @@ -186,7 +210,8 @@ BUILD() --libdir=$libDir/lighttpd --sbindir=$commandBinDir \ --with-openssl --with-zlib --with-bzip2 --with-pcre \ --with-libxml --with-ldap --with-lua --with-sqlite \ - --with-uuid --with-webdav-locks --with-webdav-props + --with-uuid --with-webdav-locks --with-webdav-props \ + --with-geoip make $jobArgs } @@ -205,7 +230,15 @@ INSTALL() $settingsDir/lighttpd/conf.d \ $dataDir/lighttpd \ $docDir - cp -f $portDir/additional-files/quickstart.txt $docDir + cp -f \ + $portDir/additional-files/quickstart.txt \ + $portDir/additional-files/quickstart-geoip.txt \ + $docDir + + constantSystemSettingsDir="`finddir B_SYSTEM_SETTINGS_DIRECTORY`" + constantSystemCacheDir="`finddir B_SYSTEM_CACHE_DIRECTORY`" + constantSystemDataDir="`finddir B_SYSTEM_DATA_DIRECTORY`" + constantSystemVarDir="`finddir B_SYSTEM_VAR_DIRECTORY`" # Tweak lighttpd.conf to have a working config with mod_ssi enabled. # Tweak ssi.conf to add index.shtml as index-file.names for mod_indexfile. @@ -215,19 +248,18 @@ INSTALL() cp doc/config/lighttpd.conf $settingsDir/lighttpd sed -i \ + -e "s|^\(## \)/etc\(/lighttpd/lighttpd\.conf\)|\1$constantSystemSettingsDir\2|" \ + -e "s|^\(## check \)/etc\(/lighttpd/conf\.d/\)|\1$constantSystemSettingsDir\2|" \ -e "/^var\.log_root/ \ - s|\"/var\(/log/lighttpd\"\)|\"$localStateDir\1|" \ + s|\"/var\(/log/lighttpd\"\)|\"$constantSystemVarDir\1|" \ -e "/^var\.server_root/ \ - s|\"/srv/www\"|\"$dataDir/lighttpd/www\"|" \ + s|\"/srv/www\"|\"$constantSystemDataDir/lighttpd/www\"|" \ -e "/^var\.server_root/ \ - a #var.server_root = \"/$relativeSharedStateDir/www\"" \ - -e "/^var\.state_dir/ s|\"/var/run\"|\"$localStateDir\"|" \ - -e "/^var\.home_dir/ \ - s|\"/var/lib/lighttpd\"|\"$localStateDir/lib/lighttpd\"|" \ + a #var.server_root = \"/$relativeSharedStateDir/www\"" \ + -e "/^var\.state_dir/ \ + s|\"/var/run\"|\"$constantSystemVarDir/run\"|" \ -e "/^var\.conf_dir/ \ - s|\"/etc\(/lighttpd\"\)|\"/system/$relativeSettingsDir\1|" \ - -e "/^var\.cache_dir/ \ - s|\"/var\(/cache/lighttpd\"\)|\"$localStateDir\1|" \ + s|\"/etc\(/lighttpd\"\)|\"$constantSystemSettingsDir\1|" \ -e "/^server\.use-ipv6 / s|\"enable\"|\"disable\"|" \ -e "s|^server\.username |#&|" \ -e "s|^server\.groupname |#&|" \ @@ -237,28 +269,49 @@ INSTALL() -e "/^server\.event-handler/ \ s|\"linux-sysepoll\"|\"select\"|" \ -e "/^server\.upload-dirs/ \ - s|\"/var/tmp\"|\"$localStateDir/tmp/lighttpd\"|" \ + s|\"/var/tmp\"|\"$constantSystemVarDir/tmp/lighttpd\"|" \ + -e "/^## \$ cat / \ + s|/etc\(/ssl/private/lighttpd\.key\)|$constantSystemSettingsDir\1|" \ + -e "/^## \$ cat / \ + s|/etc\(/ssl/certs/lighttpd\.crt\)|$constantSystemSettingsDir\1|" \ + -e "s| /etc\(/ssl/private/lighttpd\.pem\)| $constantSystemSettingsDir\1|" \ -e "/^#ssl\.pemfile/ \ - s|\"/etc/ssl\(/private/lighttpd.pem\"\)|\"$dataDir\1|" \ + s|\"/etc\(/ssl/private/lighttpd.pem\"\)|\"$constantSystemSettingsDir\1|" \ + -e "/^ssl\.pemfile/ \ + s|\"/etc\(/ssl/private/www\.example\.com\.pem\"\)|\"$constantSystemSettingsDir\1|" \ + -e "/^#include_shell \"cat \/etc/ \ + s|/etc\(/lighttpd/\)|\"$constantSystemSettingsDir\1|" \ -e "/^include \"modules\.conf\"/ \ a index-file.names += ( \"index.lighttpd.html\" )" \ $settingsDir/lighttpd/lighttpd.conf cp doc/config/modules.conf $settingsDir/lighttpd + # Insert commented inclusion of geoip.conf before ssi.conf sed -i \ + -e '/^## mod_ssi/ i ## mod_geoip\ +##\ +#include "conf.d/geoip.conf"\ +\ +##' \ -e "s|^#\(include \"conf\.d/ssi\.conf\"\)|\1|" \ $settingsDir/lighttpd/modules.conf cp doc/config/conf.d/*.conf $settingsDir/lighttpd/conf.d + sed -i \ -e "/^ssi\.extension/ \ a index-file.names += ( \"index.lighttpd.shtml\" )" \ $settingsDir/lighttpd/conf.d/ssi.conf + sed -i \ + -e "/^#geoip\.db-filename =/ \ + s|/path/to/GeoCityLite\.dat|$constantSystemCacheDir/GeoIP/GeoLiteCity.dat|" \ + $settingsDir/lighttpd/conf.d/geoip.conf + # Create a read-only copy of the settings cp -rp $settingsDir/lighttpd $dataDir/lighttpd/template-settings - mkdir -p $dataDir/lighttpd/www/htdocs + mkdir -p $dataDir/lighttpd/www/htdocs/geoip # Create and install a static index.lighttpd.html test page from the template. @@ -271,7 +324,7 @@ INSTALL() -e "s|@LIGHTTPD_VERSION@|lighttpd/$portVersion|" \ $dataDir/lighttpd/www/htdocs/index.lighttpd.html -# Create and install the SSI index.shtml test page from the template. +# Create and install the SSI index.lighttpd.shtml test page from the template. cp $portDir/additional-files/index.template \ $dataDir/lighttpd/www/htdocs/index.lighttpd.shtml @@ -282,6 +335,11 @@ INSTALL() -e "s|@LIGHTTPD_VERSION@||" \ $dataDir/lighttpd/www/htdocs/index.lighttpd.shtml +# Create and install the geoip.shtml demo page. + + cp $portDir/additional-files/geoip.shtml \ + $dataDir/lighttpd/www/htdocs/geoip/index.lighttpd.shtml + # Install headers in $includeDir/lighttpd/ for building third-party modules. mkdir -p $includeDir/lighttpd cp -p src/*.h $includeDir/lighttpd @@ -295,7 +353,15 @@ INSTALL() rm -f $includeDir/lighttpd/$i done - packageEntries devel $developDir + packageEntries mod_geoip \ + $libDir/lighttpd/mod_geoip.so \ + $settingsDir/lighttpd/conf.d/geoip.conf \ + $dataDir/lighttpd/template-settings/conf.d/geoip.conf \ + $dataDir/lighttpd/www/htdocs/geoip \ + $docDir/quickstart-geoip.txt + + packageEntries devel \ + $developDir } TEST()