This document is about the Lighttpd Webserver and how you, a developer or system administrator, would install and configure the WURFL Module for Lighttpd on Unix/Linux and MAC OS X.
IMPORTANT: Installing libwurfl
In order for the Module to work it is ESSENTIAL that the
libwurfl library is installed on your system.
libwurfl is provided in your Customer Vault/FileX.
IMPORTANT: The WURFL Lighttpd Module is available starting from WURFL version 18.104.22.168.
We provide a
lighttpd-mod_wurfl-XX.tar.gz archive containing an example configuration
wurfl.conf and the module itself, where XX is the currently used WURFL version.
Every distribution, with the exception of CentOS, has its own version of Lighttpd available in their main repository.
To avoid having to compile
Lighttpd from source, you can add the EPEL (Extra Packages for Enterprise Linux) repository
to get a ready-to-install version of Lighttpd. Check out this
link for further information on how to add the repository on CentOS 5 or CentOS 6.
Note that any module compiled, for example, with Lighttpd 1.4.35 will NOT work on any other version. If you decide to upgrade Lighttpd in the future, please contact ScientiaMobile to get our WURFL module for that particular version.
This table shows the currently used Lighttpd versions on every distribution we support:
|Distribution||Lighttpd version||Reference repository|
|CentOS 6 64bit||1.4.35||EPEL repository|
|CentOS 6 32bit||1.4.35||EPEL repository|
|CentOS 5 64bit||1.4.35||EPEL repository|
|Fedora 19 64bit||1.4.35||Official repository|
|Debian 6 64bit||1.4.28||Official repository|
|Debian 7 64bit||1.4.31||Official repository|
|Ubuntu 12.04 64bit||1.4.28||Official repository|
|Ubuntu 13.04 64bit||1.4.31||Official repository|
|Ubuntu 13.10 64bit||1.4.31||Official repository|
|Ubuntu 14.04 64bit||1.4.33||Official repository|
|FreeBSD 9 64bit||1.4.35||Official repository|
|SmartOS base64:1.8.4 64bit||1.4.29||Official Joyent repository|
|MacOSX 10.9.2 Mavericks 64bit||Latest version (currently 1.4.35)||Lighttpd official site, build from source code|
Let's take CentOS 6 64 bit and
lighttpd-mod_wurfl-22.214.171.124.tar.gz as an example.
Make sure you have already installed Lighttpd from the EPEL repository (version 1.4.35 as of May, 7th 2014); if not, just type:
yum install lighttpd
Lighttpd places its configuration files into
/etc/lighttpd where you can find
the two main configuration files named
For example, extract the contents of
lighttpd-mod_wurfl-126.96.36.199.tar.gz archive into
where myself is your account name, and execute the following commands:
cp /home/myself/lighttpd-mod_wurfl-188.8.131.52/mod_wurfl.so /usr/lib64/lighttpd/ cp /home/myself/lighttpd-mod_wurfl-184.108.40.206/wurfl.conf /etc/lighttpd/conf.d/
To enable the WURFL module for Lighttpd, include the
file amongst the ones Lighttpd loads by default. You will need to manually edit
/etc/lighttpd/modules.conf and add the following include directive at the end
of that file:
With the module loaded, Lighttpd is ready to launch. Exectute the following command (if you want to daemonize Lighttpd just remove the -D option):
lighttpd -D -f /etc/lighttpd/lighttpd.conf
Since there is no official Lighttpd installer for MacOSX, we are forced to build the latest available version (version 1.4.35 as of May, 7th 2014) from source code. Here you can find a list of 1.4.x releases.
First, download the 1.4.35 Lighttpd version and extract the archive:
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.35.tar.gz tar -zxvf lighttpd-1.4.35.tar.gz
On some systems it may be necessary to export an extra environment variable before building the source code. This is because the autoconf tool cannot always find where automake is installed. Execute the following commands:
which automake # The output should be something like /usr/local/bin/automake export AUTOMAKE=/usr/local/bin/automake
Lighttpd depends also on Python version 2.6 or above, so make sure that this is also installed prior to building the source files. To check your installed python version, just type:
We are now ready to build Lighttpd:
autoreconf -fi ./configure --prefix=/usr/ #You can choose where to install Lighttpd through the configure's --prefix option make clean make install
We provide the
lighttpd-mod_wurfl-XX.tar.gz package which contains our
mod_wurfl.so and a WURFL configuration file named
Remember that we need to enable our module by including the
wurfl.conf file, and this
can be done by manually editing
if it exists) by adding the following line:
Now that everything is in place and set up, we can launch the lighttpd process
by executing (if you want to daemonize Lighttpd just remove the
lighttpd -D -f /etc/lighttpd/lighttpd.conf
Here is an example of a wurfl.conf configuration file. You can configure the following WURFL options:
server.modules += ( "mod_wurfl" ) wurfl.root = "/usr/share/wurfl/wurfl-eval.xml" ### Specify the Engine Target. Possible values are: ### [high_]accuracy ### [high_]performance wurfl.target = "performance" ### Specify the Useragent Priority. Possible values are: ### useragent_priority_override_sideloaded_browser_useragent ### useragent_priority_use_plain_useragent wurfl.useragent-priority = "useragent_priority_override_sideloaded_browser_useragent" ### Specify the Cache to be used by WURFL. Possible values are: ### "none" ### "double_lru:<num,num>" wurfl.cache = "double_lru:10000,3000" ### Specify a set of comma-separated user requested capabilities in the format: "capability1,capability2" ### Comment this line if you want WURFL to load all the capabilities. wurfl.requested-capabilities = "device_os,device_os_version,is_tablet,is_wireless_device,pointing_method,preferred_markup,resolution_height,resolution_width,ux_full_desktop,xhtml_support_level,is_smarttv,can_assign_phone_number,brand_name,model_name,marketing_name,mobile_browser_version"
Also note that the requested capability values will be placed in appropriate
environment variables having a
WURFL_ prefix. For example, if you requested
marketing_name capability, the environment variable will be called
For a list of all supported capabilities please take a look at the full list of capabilities.
The WURFL Lighttpd module sets some useful convenience environment variables to retrieve information regarding the currently active WURFL configuration. Consider that these environment variables are automatically calculated and are always available.
|WURFL_API_VERSION||Contains a string representing the currently used Libwurfl API version||220.127.116.11|
|WURFL_INFO||A string containing informations on the parsed
|WURFL_LAST_LOAD_TIME||Contains the UNIX timestamp of the last time WURFL has been loaded successfully.||18.104.22.168|
|WURFL_ENGINE_TARGET||Contains a string representing the currently set WURFL Engine Target. Possible values are
|WURFL_USERAGENT||The original useragent coming with this particular web request||22.214.171.124|
|WURFL_NORMALIZED_USERAGENT||The normalized useragent of this device||126.96.36.199|
|WURFL_ROOTID||Contains the device root ID of the matched device.||188.8.131.52|
|WURFL_ID||Contains the device ID of the matched device.||184.108.40.206|
|WURFL_ISDEVROOT||Tells if the matched device is a root device. Possible values are
|WURFL_USERAGENT_PRIORITY||The user agent priority WURFL is currently using||1.5.2|
One way to test our module is by using the Lighttpd FastCGI module and PHP.
Before installing the Lighttpd FastCGI module, we must manually edit PHP's
main configuration file,
php.ini, by locating this line and uncommenting it (by
removing the leading
Some PHP versions on different distributions should already have this variable
set to 1 by default, but you should double check to be sure that
will work as expected.
Also, some distributions (like CentOS) have specific packages for Lighttpd FastCGI
module named lighttpd-fastcgi. In this case you simply need to install it and make
sure that, in the modules.conf (or
is uncommented. If the lighttpd-fastcgi package is unavailable you need to check
mod_fastcgi.so module exists on your distribution by typing:
find / -name "mod_fastcgi.so" | grep lighttpd
If the module exists then you just have to enable the module by including the
fastcgi.conf configuration file into
Otherwise, you will need to build Lighttpd from source (1.4.35 is the latest available
version as of May, 7th 2014, take a look at the
Lighttpd main page for more information).
At this point we have to tell FastCGI where to find the backing
Take note of the
which command output (path to php-cgi,
/usr/bin/php-cgi for example)
and edit Lighttpd's
fastcgi.conf adding the following lines:
fastcgi.server = ( ".php" => (( "bin-path" => "/usr/bin/php-cgi", "socket" => "/tmp/php.socket" )))
Lighttpd does listen on port 80 by default, however, the server's document root may
vary depending on your distribution. If the server's document root directory is
/var/www/lighttpd, we can write an
index.php (containing a
call) and place it into that directory
It is time to launch Lighttpd with our module and FastCGI module loaded:
lighttpd -f /etc/lighttpd/lighttpd.conf
In order to verify if the module is working correctly, open a web browser and type
localhost/index.php. You should see the
phpinfo() printed onscreen, including
all the WURFL information you requested in
wurfl.conf, and some other
basic information such as WURFL version.
On some distributions like Debian6 or Debian7 there is no
modules.conf and the
conf.d/ directory is missing. Instead, the
/etc/lighttpd structure looks like this:
/etc/lighttpd/conf-available /etc/lighttpd/conf-enabled /etc/lighttpd/lighttpd.conf
The conf-available directory is essentially the equivalent of
conf.d. Thus, you can place
wurfl.conf under that directory and include the directive into
SmartOS usually looks in the wrong path for the libgcc core library, which causes segmentation faults when handling exceptions.
To fix this, we must tell SmartOS where to find the right libgcc library in the following way:
2017 ScientiaMobile Incorporated All Rights Reserved.
NOTICE: All information contained herein is, and remains the property of ScientiaMobile Incorporated and its suppliers, if any. The intellectual and technical concepts contained herein are proprietary to ScientiaMobile Incorporated and its suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from ScientiaMobile Incorporated.
2017 - ScientiaMobile, Inc. All rights reserved. WURFL® is the registered trademark of ScientiaMobile, Inc.