How to install lighttpd from source code

Lighttpd is a secure, fast, compliant, and very flexible web server that has been optimized for high-performance environments. In this post, we will be installing Lighttpd by compiling the source code.

To install lighttpd from the source, first, let’s install the requirements

For RHEL, CentOS, AlmaLinux, etc..

Use yum instead of dnf if you are using an older version, for example, CentOS 7

For Ubuntu/Debian

Next, we will download and install lighttpd, you can get the latest version download link from

https://www.lighttpd.net/

If you get error

install pcre2 devel package

RHEL

For Ubuntu/Debian

If you get error related to zlib “configure: error: zlib headers not found, install them or build without –with-zlib”, install

For Ubuntu/Debian

Create User

Let’s create a user for running lighttpd

For Ubuntu/Debian

Instead of creating a new user, you can also use user nobody on RHEL based distros, www-data on Ubuntu.

Install configuration files

To setup default lighttpd.conf file, run

Create a directory for log files

Copy service files

Update configuration files

Edit

Find

Comment the line.

Edit /etc/lighttpd/lighttpd.conf

Find

Replace with

Update server document root as needed

Starting lighttpd

Verify configuration file has now errors

Run lighttpd manually

You can enable/start lighttpd with

back to lighttpd

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published.