How To Install Lighttpd on CentOS Stream 10 (Step-by-Step Guide)

Learn how to install Lighttpd on CentOS Stream 10 with this complete step-by-step guide

Lighttpd is a fast, lightweight, and event-driven web server optimized for high-performance environments. It’s widely used for running static sites, microservices, APIs, and low-resource hosting environments.
If you’re using CentOS Stream 10, this guide will walk you through a clean and reliable setup of Lighttpd from installation to service configuration.

This tutorial is written for beginners and system administrators who want a minimalistic yet scalable web server.

Table of Contents

  1. What Is Lighttpd?
  2. Why Use Lighttpd on CentOS Stream 10?
  3. Prerequisites
  4. Step 1: Update System Packages
  5. Step 2: Add Lighttpd Repository (if required)
  6. Step 3: Install Lighttpd
  7. Step 4: Start and Enable the Lighttpd Service
  8. Step 5: Configure Firewall
  9. Step 6: Verify Lighttpd Installation
  10. Step 7: Configure Lighttpd Basic Settings
  11. Step 8: Enable PHP (Optional)
  12. Troubleshooting Tips
  13. Conclusion

1. What Is Lighttpd?

Lighttpd (“lighty”) is an open-source web server known for being:

  • Lightweight and resource-efficient
  • Event-driven and asynchronous
  • Ideal for handling large numbers of parallel connections
  • Suitable for embedded systems, low-resource VPS, or static hosting

It’s a great alternative to Apache or Nginx when you need something fast, stable, and extremely low on RAM usage.

2. Why Use Lighttpd on CentOS Stream 10?

CentOS Stream 10 provides a modern, rolling-release environment with up-to-date packages and long-term stability. Lighttpd fits perfectly in environments where you want:

  • A small memory footprint
  • Fast static file serving
  • Efficient microservice hosting
  • Reverse proxy capability
  • A simple configuration syntax

CentOS Stream’s updated repository also makes installation straightforward.

3. Prerequisites

Before you begin, ensure:

  • You have a server running CentOS Stream 10
  • You have root or sudo access
  • You have internet connectivity

4. Step 1: Update System Packages

Begin by updating your system to make sure all existing packages are up-to-date.

sudo dnf update -y

5. Step 2: Add Lighttpd Repository (If Required)

Some CentOS Stream builds may not include Lighttpd in the default repo.
If Lighttpd isn’t found during installation, enable EPEL:

sudo dnf install epel-release -y

Then refresh the repository:

sudo dnf update -y

6. Step 3: Install Lighttpd

Now install Lighttpd:

sudo dnf install lighttpd -y

Verify the package:

lighttpd -v

7. Step 4: Start and Enable the Lighttpd Service

Enable Lighttpd so it runs automatically on reboot:

sudo systemctl enable lighttpd

Start the service:

sudo systemctl start lighttpd

Check status:

sudo systemctl status lighttpd

You should see active (running).

8. Step 5: Configure Firewall

Allow HTTP traffic:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

(Optional) Allow HTTPS:

sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

9. Step 6: Verify Lighttpd Installation

Open your browser and visit:

http://your_server_ip/

You should see the default Lighttpd test page.

If you’re using a cloud server, ensure your cloud firewall also allows port 80.

10. Step 7: Configure Lighttpd Basic Settings

Lighttpd’s main configuration file is located at:

/etc/lighttpd/lighttpd.conf

Enable Directory Listing

sudo sed -i 's/#dir-listing.activate = "enable"/dir-listing.activate = "enable"/' /etc/lighttpd/lighttpd.conf

Change Document Root

Edit:

sudo nano /etc/lighttpd/lighttpd.conf

Find:

server.document-root = "/var/www/lighttpd"

Change it to your desired directory.

Apply configuration changes:

sudo systemctl restart lighttpd

11. Step 8: Enable PHP (Optional)

If you want Lighttpd to run PHP scripts, install PHP-FPM:

sudo dnf install php php-fpm -y

Start the service:

sudo systemctl enable --now php-fpm

Enable FastCGI in Lighttpd

Edit:

sudo nano /etc/lighttpd/modules.conf

Uncomment:

include "conf.d/fastcgi.conf"
include "conf.d/fastcgi-php.conf"

Restart services:

sudo systemctl restart lighttpd
sudo systemctl restart php-fpm

Test PHP

Create a test file:

echo "<?php phpinfo(); ?>" | sudo tee /var/www/lighttpd/info.php

Open:

http://your_server_ip/info.php

You should see the PHP information page.

12. Troubleshooting Tips

Lighttpd does not start

Check configuration syntax:

sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf

Port 80 already in use

Look for services:

sudo lsof -i :80

Stop Apache or Nginx if required:

sudo systemctl stop httpd
sudo systemctl stop nginx

Permission denied on document root

Ensure correct ownership:

sudo chown -R lighttpd:lighttpd /var/www/lighttpd
sudo chmod -R 755 /var/www/lighttpd

13. Conclusion

Installing Lighttpd on CentOS Stream 10 is simple and efficient.
With just a few commands, you get a lightweight, high-performance web server ideal for static sites, microservices, or low-resource hosting environments.

Whether you’re building a minimal API server or running small web applications, Lighttpd offers impressive speed and reliability without consuming large system resources.

(Visited 1 times, 1 visits today)

You may also like