The installation and configuration of Lighttpd server on Debian Linux
The IPv6 support is enabled by default during the Lighttpd server installation.
There are 2 ways of installation Lighttpd server on Linux system. The first one is the installation using distribution repositories and the second is the installation from latest source code from Lighttpd vendor's website.
Each installation method requires administrator privileges.
During the installation from source code there is a possibility to enable additional modules for compilation.
The installation from repository (special designed packages for specific linux distribution) is prepared by developers of concrete distribution. This kind of installation has enabled some of the additonal modules, is well adjusted for operating system (e.g. directiory hierarchy). But it is not the newest version of the application (Lighttpd).
To install the Lighttpd server from the repository, enter the following command in the command line:
aptitude install lighttpd
For proper installation there are required:
- C++ compilator
- make utility.
In the beginning there is a need of downloading Lighttpd server from http://www.lighttpd.net/download
After downloading the file, unzip it by entering the following command:
tar xvf lighttpd-VERSION_NUMBER.tar.gz
where VERSION_NUMBER stands for the version of downloaded Lighttpd Server
Enter to the lighttpd-VERSION_NUMBER directory by typing the command:
cd lighttpd-NUMER_WERSJI/
The next step is preparing the configuration files to a compilation. It is done by the following command:
./configure --with-ipv6 –-prefix=PREFIX
where PREFIX is a path where the Lighttpd server should be installed.
Then compile the Lighttpd server by typing the command:
make
The last step is a final installation of an application by using the command:
make install
The Lighttpd server does not have configuration file after the installation. There must be created lighttpd.conf file in the directory, where www server is installed. Create such file by typing the following command:
touch /PREFIX/lighttpd.conf
where PREFIX is a path where the Lighttpd server should be installed.
In such file there must be definied WWW server configuration. There is an example configuration, which provides a site in both IPv4 and IPv6 addresses.
server.document-root = "/var/www/lighttpd/"
server.port = 80
$SERVER["socket"] == "[::]:80" { }
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
Lighttpd supports IPv6, if it is installed with default parameter. It can be checked by using the commands:
lighttpd=`find / -name lighttpd -type f | grep bin/lighttpd`
$lighttpd -V
Figure 1. Checking if Lighttpd server supports IPv6.
The '+' sign means, that Lighttpd supports IPv6 protocol.
Before any action, there must be found a localization of configuration directory of Lighttpd server.
The path to configuration files can be found by following command:
find / -name lighttpd.conf
For adding, modificating or checking IP addresses, which are used to access a site, there should be viewed the lighttpd.conf file.
To do that use a command:
cat /PATH/lighttpd.conf
where PATH is a direct path to configuration directory of Lighttpd server.
The IPv4 adresses, which provide access to sites, are defined by server.bind definition and the ports are defined by server.port.
An example configuration for server listening on IPv4 address 192.168.3.4 and port 80:
server.bind = "192.168.3.4"
server.port = "80"
If server.bind definition is not defined or is defined as a value of "0.0.0.0", the Lighttpd server listens on everey single IPv4 adresses it finds on network interfaces.
If a server should listen on a specific IPv6 address e.g. 2001:db8::4, there is a need for following entry:
$SERVER["socet"] == "[2001:db8::4]:80" {}
In case then Lighttpd server should listen on every IPv6 adresses found in network interfaces in the operation system, there is a need of following entry:
$SERVER["socet"] == "[::]:80" {}
Figure 2. A sample LIghttpd server configuration for listening on specific IPv4 and IPv6 adresses
After changing the configuration, there must be a restart of Lighttpd application.
When Lighttpd was installed from repository, type the following command:
/etc/init.d/lighttpd restart
When Lighttpd was installed source code, type the following commands:
killall lighttpd
/PATH/sbin/lighttpd –f /PATH/lighttpd.conf
where PATH is a direct path to installation directory of Lighttpd server.
To verify that the webserver configuration is proper, type the IPv6 address in square brackets into web browser as shown in Figure 3:
Figure 3. The verification if Lighttpd is working properly with selected IPv6 address
©2012 IIP