Lighttpd is a slim alternative to the Apache web server for Unix, Linux and Windows server operating systems. Its primary objective is to deliver web content in a fast, secure manner.
The Lighttpd web server is handy, especially for those that need to deliver content on the web on Linux but don’t necessarily have an impressive amount of CPU and RAM.
Setting up the Lighthttpd web server isn’t much like setting up Apache or Nginx on Linux. There are no packages available on the development website. Instead, if you want to use it, you must download a package, and install it manually. Here’s how to do it.
Download Lighttpd RPM package
A while ago, there was a Lighttpd RPM package for CentOS/RedHat Enterprise Linux. However, it seems that the developers of the web server don’t distribute these anymore. So, if you’d like to use Lighttpd, the source code is required.
To download the source code, you will need the wget downloading tool. As most server operating systems don’t always include this program, installation is required.
sudo apt install wget
sudo apt-get install wget
sudo pacman -S wget
sudo yum install wget
sudo dnf install wget
sudo zypper install wget
Once you’ve got the wget downloading tool up a d running on your Linux server (or Desktop you’re using as a server,) use the CD command and move the terminal session to the /tmp directory.
if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);
RECOMMENDED FOR YOU
Doing the downloading in the /tmp (aka temporary) directory will ensure that once the software is up and running, it doesn’t litter your file system.
Now that the terminal is in the temporary directory invoke wget and grab the source code release of lighttpd.
Alternatively, if you have issues with the TarGZ release, the developers have a TarXZ release available.
The lighttpd web server package should take a couple of seconds to download, depending on your internet connection. When the process is complete, move on to the next section of this tutorial.
Extract source code
With the code now done downloading on Linux server system inside of the temporary directory (/tmp), it is now time to extract the code from its archive. Extracting the Lighttpd code files on Linux is done with the tar command.
In a terminal, write tar with the “zxvf” switches. This will allow you to extract and view the contents of the TarGZ archive.
tar zxvf lighttpd-1.4.52.tar.gz
Alternatively, if you downloaded the TarXZ archive instead of the TarGZ, you will need to use the tar command with a different set of switches. Specifically, the “xvJf” ones.
tar xvJf lighttpd-1.4.52.tar.xz
With the code extracted, run the CD command and move the terminal into the new folder.
From there, use ls and view the contents of the directory.
Compile Lighttpd on Linux
Building the Lighttpd web server has a few steps. It’s not overly complicated, and it starts by installing the required dependencies.
sudo apt install libpcre3-dev libbz2-dev zlib1g-dev
sudo apt-get install libpcre3-dev libbz2-dev zlib1g-dev
sudo pacman -S pcre-8 zlib bzip2
sudo dnf install pcre-devel zlib-devel libbz2-devel
sudo zypper install pcre-devel zlibary-devel libbz2-devel
With the dependencies installed, it’s time to scan your system and create the make files on the system. Make files are created with the “Configure” script.
Let the script run. It may take a few times of running and re-running the script, especially if it determines your system is missing dependency files.
In our guide, we do our best to help you install the dependencies that the script needs to generate the Make files correctly. However, it may not always work. If you have issues, check the documentation.
Once Configure is done, it’s time to build the installation using the Make command.
make sudo make install
When everything is done installing, will need to configure the server. To do this, head over to the official website.
For the most part, Lighttpd doesn’t go out of its way to maintain distro-specific packages for their web server. For this reason, we’ve covered how you can compile and build the source code. Furthermore, downloading the source code is a good way to ensure that you can get the latest release of the software, regardless of what your Linux OS is. With that said, some distributions may have a Lighttpd web server package in their primary software sources.
To find out more, head over to pkgs.org. On the page, you’ll see information about listed for several Lighttpd packages. Though, keep in mind that if you install the distribution-specific releases, it may not be updated as often as getting it straight from the developers.