About

Supporting the site

App Repository‎ > ‎

lighttpd-1.4.30

Overview

This version of lighttpd requires zlib, bzip2, PCRE, openssl, lua and SQLite. The reason is that we want to have lighttpd compiled with as many modules as possible, so that it becomes a reasonable alternative to the Apache server provided by DRI. All of that is cross-compiled and statically linked for easier deployment. This version does not reference MySQL.

Preparation

Make sure you have a cross-compiling virtual machine properly setup.

Compilation

export DEST=/mnt/DroboFS/Shares/DroboApps/lighttpd
cd ~/code/

wget http://zlib.net/zlib-1.2.5.tar.gz
tar zxf zlib-1.2.5.tar.gz
cd zlib-1.2.5
CFLAGS="$CFLAGS -O3" ./configure --prefix=$DEST --static
make clean && make
ZLIB=`pwd`
cd ..

wget http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar zxf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6/
make clean
make libbz2.a CC=$CC AR=$AR RANLIB=$RANLIB CFLAGS="$CFLAGS -Wall -Winline -O3 -g -D_FILE_OFFSET_BITS=64"
BZIP=`pwd`
cd ..

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
tar zxf pcre-8.21.tar.gz
cd pcre-8.21
CFLAGS="$CFLAGS -O3 -I$ZLIB -I$BZIP" CXXFLAGS="$CFLAGS" LDFLAGS="-L$ZLIB -L$BZIP" ./configure --host=arm-none-linux-gnueabi --prefix=$DEST --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-unicode-properties --disable-shared
make clean && make
PCRE=`pwd`
cd ..

wget http://openssl.org/source/openssl-1.0.0f.tar.gz
tar zxf openssl-1.0.0f.tar.gz
cd openssl-1.0.0f
./Configure linux-generic32 -DL_ENDIAN --prefix=$DEST --openssldir=$DEST/etc/ssl no-shared no-zlib-dynamic --with-zlib-include=$ZLIB --with-zlib-lib=$ZLIB
sed -i -e "s/CFLAG= /CFLAG=${CFLAGS} /g" Makefile
make clean && make && make install_sw
rm -fr $DEST/include
rm -fr $DEST/lib
OPENSSL=`pwd`
cd ..

wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
tar zxf lua-5.1.4.tar.gz
cd lua-5.1.4/
make clean
make PLAT=linux INSTALL_TOP=$DEST RANLIB=$RANLIB CC=$CC AR="$AR rcu" CFLAGS="$CFLAGS -O3 -Wall " LIBS="-lm "
LUA=`pwd`
cd ..

wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
tar zxf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
CFLAGS="$CFLAGS -O3 -I$ZLIB" LDFLAGS="$LDFLAGS -L$ZLIB -lz -lm" ./configure --host=arm-none-linux-gnueabi --prefix=$DEST --with-zlib --without-python --disable-shared
make clean && make
LIBXML=`pwd`
cd ..

wget http://www.sqlite.org/sqlite-autoconf-3070900.tar.gz
tar zxf sqlite-autoconf-3070900.tar.gz
cd sqlite-autoconf-3070900/
CFLAGS="$CFLAGS -O3" LIBS="-ldl -lpthread" ./configure --host=arm-none-linux-gnueabi --prefix=$DEST --enable-shared=no
make clean && make
SQLITE=`pwd`
cd ..

wget http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/1.42/e2fsprogs-libs-1.42.tar.gz
tar zxf e2fsprogs-libs-1.42.tar.gz
cd e2fsprogs-libs-1.42/
CFLAGS="$CFLAGS -O3" ./configure --host=arm-none-linux-gnueabi --prefix=$DEST --disable-elf-shlibs 
cd lib/uuid/
make clean && make
LIBUUID=`pwd`
cd ../../..

wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.30.tar.gz
tar zxf lighttpd-1.4.30.tar.gz
cd lighttpd-1.4.30/
CFLAGS="$CFLAGS -O3 -I$ZLIB -I$BZIP -I$PCRE -DPCRE_STATIC -I$OPENSSL/include -I$LIBUUID/.." LDFLAGS="$LDFLAGS -L$ZLIB -L$BZIP -L$PCRE/.libs -L$OPENSSL -L$LIBUUID" LIBS="-lz -lbz2 -lpcre -luuid -lssl -lcrypto -ldl -lm -lpthread" LUA_CFLAGS="-I$LUA/src" LUA_LIBS="-L$LUA/src" XML_CFLAGS="-I$LIBXML/include" XML_LIBS="-L$LIBXML/.libs -lxml2 -lm" SQLITE_CFLAGS="-I$SQLITE" SQLITE_LIBS="-L$SQLITE/.libs -lsqlite3" ac_cv_path_PCRECONFIG=$PCRE/pcre-config ./configure --host=arm-none-linux-gnueabi --prefix=$DEST --with-openssl --with-pcre --with-zlib --with-bzip2 --with-lua --with-webdav-props --with-webdav-locks
make clean && make && make install
find $DEST -executable -type f -exec $STRIP "{}" \;

Packaging

cd $DEST
mkdir -p etc/conf-available etc/conf-enabled
mkdir -p var/log var/run var/cache var/sockets var/uploads
mkdir www
echo "lighttpd is working" > www/index.html
cp ~/code/lighttpd-1.4.30/doc/config/conf.d/*.conf etc/conf-available/
wget http://www.droboports.com/app-repository/lighttpd-1-4-30/service.sh
chmod a+x service.sh
pushd etc
wget http://www.droboports.com/app-repository/lighttpd-1-4-30/lighttpd.conf.default
cd conf-available
wget -O cgi.conf http://www.droboports.com/app-repository/lighttpd-1-4-30/cgi.conf
wget http://www.droboports.com/app-repository/lighttpd-1-4-30/droboadmin.conf
sed -i -e "s/home_dir/state_dir/g" webdav.conf
cd ../conf-enabled
ln -s ../conf-available/access_log.conf
ln -s ../conf-available/debug.conf
ln -s ../conf-available/mime.conf
ln -s ../conf-available/dirlisting.conf
ln -s ../conf-available/cgi.conf
ln -s ../conf-available/droboadmin.conf
popd
chmod -R g+w etc var www
~/bin/package.sh

Installing

Download the TGZ file below and place it in you DroboApps share. If you do not have SSH access, reboot your Drobo. Otherwise, SSH in and type:

/usr/bin/DroboApps.sh install

Final remarks

By default, this version of lighttpd will listen on ports 80 and 443 (HTTP and HTTPS respectively). It has been configured to automatically create a self-signed SSL certificate (etc/server.pem) in case no server certificate is found.

It is possible to do privilege separation, by running lighttpd on its own user (lighttpd). By default that is not the case (i.e., lighttpd will run as root), but this can be easily fixed by uncommenting the required lines in service.sh and lighttpd.conf.

This version has also been configured to automatically load any configuration file placed inside etc/conf-enabled. In other words, to add DroboApps that need deployment on lighttpd, just create a lighttpd-compatible configuration file for your DroboApp, make a symlink inside the conf-enabled folder, and restart lighttpd. It has also been configured to automatically provide access to the DroboAdmin DroboApp, if it is installed in your DroboFS. Keep in mind that the DroboAdmin app requires also PHP, which needs to be installed separately.

Upgrade advice

Upgrading from previous versions should be painless, with a few exceptions:

  • The main configuration file, etc/lighttpd.conf, is preserved if it already exists.
  • The server certificate, etc/server.pem, is preserved if it already exists.
  • The default configuration files inside etc/conf-available and their symbolic links inside etc/conf-enabled will be overwritten.
  • The file www/index.html will be overwritten.

In other words, it is highly recommended to backup at least the the subfolders etc and www.

Please visit the DroboSpace forums to leave your comments, suggestions and feedback.

ċ
cgi.conf
Download
  1k v. 1 Jan 13, 2012, 5:40 AM Ricardo Padilha
ċ
droboadmin.conf
Download
  1k v. 1 Jan 13, 2012, 5:40 AM Ricardo Padilha
ċ
lighttpd.conf.default
Download
  1k v. 2 Jan 17, 2012, 3:31 AM Ricardo Padilha
ċ
lighttpd.tgz
Download
DroboApp for DroboFS   3299k v. 3 Jan 18, 2012, 12:34 AM Ricardo Padilha
ċ
service.sh
Download
  1k v. 3 Jan 13, 2012, 5:47 AM Ricardo Padilha
Comments