How to Install Lighttpd on Ubuntu Server With Examples

In this tutorial, we will walk you through how to install Lighttpd on Ubuntu Server. Lighttpd web server is an open-source web server for Windows and UNIX/Linux. It uses minimal system resources and is extremely quick in serving web pages to the requesting clients.

This makes Lighttpd an essential web server for people looking to improve their web page loading speeds.


We have used a Ubuntu server system for this tutorial. But you can use any Ubuntu or Debian system.

Make sure you have the following two things before you begin:

  1. Access to the root user or a user with sudo privileges
  2. No existing web server application (like apache) installed

Steps to Install Lighttpd On Ubuntu Server

To install Lighttpd on Ubuntu, you don’t need to download anything. It’s available in the default Ubuntu repositories. The name of the package is “lighttpd” and you can download it using the apt command.

1. Update APT Repositories

Before we begin, we want to make sure that we can download the latest lighttpd package and to do this, we need to update our default repositories using the apt package management service.

Open the terminal on your Ubuntu system and type the following.

Once done, you’re ready to move to step two.

2. Install Lighttpd on Ubuntu Server with APT

Now that we have updated the repositories, we can proceed with the installation. We will use the apt package manager to install Lighttpd on Ubuntu server.

To do so, we enter the following in our terminal. You might be prompted to enter your user password to continue.

When you enter this command in your command line, this is what you should expect to see as the output on your screen.


Install Lighttpd

Press the enter key and proceed with the installation. Allow a couple of seconds or minutes depending on your internet speed and you should have a fully functional Lighttpd server on your system.

3. Start the Lighttpd Service

Once we install Lighttpd on Ubuntu, we need to start the service with the use of the systemctl command.

Along with starting the service, we’ll also hook the service so it starts on boot.

Now that we have started and enabled the Lighttpd service, the Lighttpd server is running on our system.

If the service is enabled properly, you should expect an output similar to this on your screen.


Start Lighttpd Service

That’s it, you have the Lighttpd service up and running on your system. Let’s move further.

4. Accessing Lighttpd On Ubuntu

When you setup any web server in Linux, the default DocumentRoot directory is /var/www unless you configure a different one.

If you place a page named index.html in the directory, you’ll be able to view the page from your browser by accessing your localhost IP (

Let’s look at the default page that’s available for Lighttpd once installed. Open your browser and type the following address in the URL bar.


If everything went right for you, you should see the page as shown above. Since we can see this page, that’s great! We can move further.

5. Allow Incoming Traffic

Our webserver is installed but it’s accessible only locally since all traffic from outside is blocked by UFW which is our default Ubuntu firewall.

Let’s add some rules to allow HTTP and HTTPS traffic to come through.

Perfect! The last command should show you that HTTP and HTTPS traffic is now allowed from any IP.

6. Additional Packages

Now that you know how to install Lighttpd on Ubuntu and serve your HTML pages over the web, you might want to know how to serve pages in PHP too.

I won’t go over the installation of specific packages as it’s all pretty straightforward. But feel free to read through this tutorial where we’ve discussed how to install Apache and PHP. You can jump right to the PHP installation part.

Side Notes

The Lighttpd web server gives you an effective and fast webserver without devouring your memory resources.

There are a few things that you need to keep in mind

  • While Lighttpd is the best when it comes to reducing the load on your system, Lighttpd’s Server Side Includes (SSI) use an unrecommended workflow to handle scripts.
  • Further, the nature of FastCGI calls for the need to define additional configurations to run web applications on a Lighttpd server.
  • You need to make sure that you secure your server properly when you install the Lighttpd server on your system.
  • Due to Lighttpd’s network-facing nature, having a server that isn’t secured properly can possibly open up your system to several vulnerabilities.


Lighttpd is one of the best web server packages you can get if you wish to get a fast, industry compliant web server without devoting a lot of system resources.

While the Lighttpd web server has some peculiarities, it does its job better than any other web server – providing fast, optimized server functionality with an advanced feature set involving FastCGI, URL rewriting, output compression and more.

This tutorial aimed to help you install Lighttpd on Ubuntu Server. With PHP and FastCGI tools, you can easily configure the server to suit your needs. As always, if you have any questions, let us know in the comments below.

By admin

Leave a Reply

%d bloggers like this: