Book Image

Lighttpd

By : Andre Bogus
Book Image

Lighttpd

By: Andre Bogus

Overview of this book

Table of Contents (20 chapters)
Lighttpd
Credits
About the Author
About the Reviewer
Preface
HTTP Status Codes

Building Lighttpd using Autotools


Lighttpd was built using Autotools until version 1.5.0, in which the authors experimented with CMake (and other build systems). The Autotools build system has been around for some time. So, almost every system that has a sufficient toolchain can build Lighttpd.

Note that the building can and should be done as a normal user, while the installation must usually be done as a superuser, unless the target directory is owned by the normal user. The easiest way (provided we have sudo) is:

configure && make && sudo make install

Before we enter this command line, we can set a few environment variables that will affect the build process. We can do this in a bash compatible shell using:

export SOME_VAR=X

This will set the variable SOME_VAR to X and export it to the shell. Alternatively, we can just omit the export if we write the variable declarations at the beginning of our command, as in:

SOME_VAR=X; OTHER_VAR=Y; configure

Here are the most important variables:

Variable name

Useful value

Description

CC

arm-gcc icc

Specify an alternate compiler if you cross-compile Lighttpd or have a more optimizing compiler compared to gcc.

CFLAGS LDFLAGS

-g -Os -L/usr/local/lib

These options go to the gcc compiler. Read up on gcc for further information.

PKG_CONFIG

/opt/pkg_config

We may need to specify where pkg-config is, if configure cannot find it.

FAM_CFLAGS FAM_LIBS

-I/opt/fam/include -L/opt/fam/lib

We can specify alternate C Flags and linker settings (for example, paths) for FAM.

LUA_CFLAGS LUA_LIBS

-I/usr/include/lua/ -llua

This tells configure where to find Lua (for example, if pkg-config is missing)

configure takes some options to select features. These options are usually expressed as:

configure --with-lua=/usr/src/lua-5.1 --with-pcre

Note that for every "with-something" option, there also is a "without-something" option that does the exact opposite. Here are the most important options:

Parameter (example)

Description

--help

This makes configure print a help screen and exit.

--prefix=/usr/ --prefix=/opt/lighttpd/

Specify your installation directory if you want to install Lighttpd at a location different from default/usr/local/.

--bindir=... --sbindir=... --datadir=... --libdir=... --sysconfdir=...

We can also set each directory individually for the installation process.

--host=PLATFORM --target=PLATFORM --build=PLATFORM

If we want to cross-compile Lighttpd or have different platforms to compile Lighttpd against, we can specify them here. Usually, we can leave these settings alone.

--enable-static --enable-shared

Makes configure build static or shared libraries to link to the Lighttpd executable. The same default is shared.

--enable-lfs

This option enables large files (above 2Gig). Set it if you host HD-movies or large genome sequence files.

--disable-ipv6

Lighttpd by default can use IPv6 in addition to the usual IPv4. Disabling it may reduce the size a little bit and quell our fears of possible bugs in the IPv6 implementation, but may leave out all users of next-gen Internet technologies in the cold.

--with-pcre

This is on by default if PCRE is available. You probably want it anyway, unless your target system is embedded.

--with-openssl

This enables SSL (usually using OpenSSL).

--with-kerberos5

This makes configure use the kerberos5 support supplied by OpenSSL.

--with-zlib --with-zlib=/usr/local/lib/

This adds libgz compression to Lighttpd (via mod_compress). If the path is omitted, configure will try to infer it.

--with-bzip --with-bzip=/opt/lib/

This adds bzip2 compression to Lighttpd (via mod_compress). See --with-zlib.

--with-fam --with-fam=/opt/fam/

This activates the use of the FAM/gamin stat cache which speeds up Lighttpd considerably on repeated requests for the same file.

--with-ldap

This allows Lighttpd to authenticate users (in mod_auth) against an LDAP directory.

--with-webdav-props --with-webdav-locks

These options enable properties and locks in WebDAV (mod_webdav).

--with-gdbm --with-memcache

These options enables the use of GDBM or memcached storage in mod_trigger_b4_dl, respectively.

--with-atttr

This makes Lighttpd support XFS' extended attributes to get the MIME type for a file (by mimetype.use-xattr).

--with-mysql --with-mysql=/opt/mysql/

This option adds MySQL support by mod_mysql_vhost. The optional path should contain mysql_config.

--with-lua --with-lua=/usr/src/lua

This enables the use of the Lua programming language to be embedded into lightTPD as mod_magnet.

--with-valgrind

This adds internal valgrind support. We only need this if we want to debug Lighttpd memory usage.

The make utility will use the Makefile that configure has generated to build and install Lighttpd. Configure Lighttpd to your needs, but the defaults will take care of most of them.