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.
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.
We provide an archive (
lighttpd-mod_wurfl-XX.tar.gz) containing an example configuration
wurfl.conf and the module itself, where XX is the current up-to-date version.
Every distribution, with the exception of CentOS, has its own version of Lighttpd available in the 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.
Please Note that any module compiled, 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 the correct module for that particular version.
This table shows the currently used Lighttpd versions on every distribution we support:
|Distribution||Lighttpd version||Reference repository|
|CentOS 5 64bit||Latest||EPEL repository|
|CentOS 6 64bit||Latest||EPEL repository|
|CentOS 7 64bit||Latest||EPEL repository|
|Debian 6 64bit||Latest||Official repository|
|Debian 7 64bit||Latest||Official repository|
|Debian 8 64bit||Latest||Official repository|
|Ubuntu 10.04 64bit||Latest||Official repository|
|Ubuntu 12.04 64bit||Latest||Official repository|
|Ubuntu 13.04 64bit||Latest||Official repository|
|Ubuntu 14.04 64bit||Latest||Official repository|
|Ubuntu 15.04 64bit||Latest||Official repository|
|Ubuntu 16.04 64bit||Latest||Official repository|
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
Here is an example of a wurfl.conf configuration file. You can configure the following WURFL options:
wurfl.updater takes two parameters, comma separated:
- data url taken from your personal Scientiamobile Vault account, choosing between two
data file types:
- updater checking frequency how often the Updater checks for a new WURFL data file
to be downloaded and used by the engine. Options are:
Do note that the
WurflRoot file type and
data url file types match so you may need to change the
file type accordingly.
In order to let the Updater perform its activities, both the
WurflRoot folder and file must be writable by the lighttpd process.
wurfl-updater.log file in
WurflRoot folder will contain details on Updater activity.
server.modules += ( "mod_wurfl" ) wurfl.root = "/usr/share/wurfl/wurfl.zip" ### Specify the user agent 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" ### "lru:<num>" wurfl.cache = "lru:10000" ### Specify a set of comma-separated user requested static capabilities and virtual capabilities in the format: "capability1,capability2,...,capabilityN" wurfl.requested-capabilities = "is_tablet,brand_name,is_robot,advertised_device_os" ### Specify a set of comma-separated user requested properties in the format: "property1,property2,...,propertyN" ###wurfl.requested-properties = "wurfl_useragent,wurfl_engine_target" ### -- WURFL Updater allows seamless update of WURFL engine with new data downloaded from Scientiamobile. ### -- WURFL file should be either .zip or .xml.gz and match WurflRoot file type ### -- Put your personal updater url taken from Scientiamobile customer Vault. ### -- Valid values for the updater check frequency (how often the updater checks for any new WURFL data file ### -- to be downloaded and used by the engine) are DAILY,WEEKLY ### -- Updater log file (wurfl-updater.log) may be found in "WurflRoot" folder. The folder and wurfl.zip file must be ### -- writable by Lighttpd process ###wurfl.updater = "https://data.scientiamobile.com/xxxxx/wurfl.zip,DAILY"
The requested static and virtual capability values will be placed in the appropriate
environment variables with 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, if specified in
wurfl.requested-properties option as a list comma separated.
wurfl_id variable is set by default so you don't have to specify it in the
wurfl.requested-properties options list.
|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|
Note: Both php and php-cgi must be installed prior to test the module using FastCGI.
One way to test the 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
lighttpd-fastcgi. In this case you simply need to install it and make
sure that, in the
is uncommented. If the
lighttpd-fastcgi package is unavailable, 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 the 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
IMPORTANT - Decommissioning of Engine Target options
Prior to version 1.9 of the API, users could choose between Performance and Accuracy engine optimization options. These options had been introduced years ago to manage the behavior of certain web browsers and their tendency to present "always different" User-Agent strings that would baffle strategies to cache similar WURFL queries in memory.
As the problem has been solved by browser vendors, the need to adopt this strategy has diminished and ultimately disappeared (i.e. there was no longer much to be gained with the performance mode in most circumstances) and ScientiaMobile elected to "remove" this option to simplify configuration and go in the direction of uniform API behavior in different contexts.
© 2018 ScientiaMobile Inc.
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.
2018 - ScientiaMobile, Inc. All rights reserved. WURFL® is the registered trademark of ScientiaMobile, Inc.