How to install lighttpd web server on Ubuntu 22.04 Jammy

Simple steps to install Lighttpd web server on Ubuntu 22.04 LTS Jammy JellyFish using the commands given in this article.

lighttpd (lighty) is a web server that requires much less resources than Apache, for example, and is therefore particularly suitable for very large loads or very weak systems. It was developed by Jan Kneschke and can be supplemented with modules. FastCGI, for example, allows you to execute PHP code. SCGI slightly complements Ruby or Python.

Steps to Install Lighttpd Web Server on Ubuntu 22.04

1. Install Lighttpd on Ubuntu 22.04

lighttpd can be installed directly from the official package sources on Ubuntu 22.04 Jammy, so we don’t need a third-party repository like Apache. Run the given single command to install this web server.

sudo apt install lighttpd -y

2. Start and activate the Lighttpd service

After the installation is complete, the user can start and enable the web server service so that it can be started automatically even after system or server restart.

sudo systemctl start lighttpd
sudo systemctl enable lighttpd

To check the status:

systemctl status lighttpd

3. Lighttpd setup on Ubuntu 22.04

The Lighttpd is configured via the file /etc/lighttpd/lighttpd.conf . This can be edited with any text editor with root rights. Many configuration options are described in detail in the configuration file itself.

Example:

sudo nano /etc/lighttpd/lighttpd.conf

4. Enable CGI

CGI is an interface between the web server and the operating system, for example to execute Perl scripts through the web server. Dynamic content can be generated this way. Thus, this module can be activated via this command:

sudo lighty-enable-mod cgi

5. Access the default Lighttpd webpage

Open your browser and point to the IP address of the server where you installed the Lighttpd web server. You will get the default page for this web server.

6.HTTP Authentication

To password protect directories, the authentication module is required and can be activated via

sudo lighty-enable-mod auth
sudo service lighttpd force-reload

The use of .htaccess files known to apache is unfortunately not possible with lighty. Instead, parameters must be set in the configuration file /etc/lighttpd/conf-enabled/05-auth.conf, and web server restart is required.

Authentication is possible with basic and digestwhere the backends plain, htpasswd, htdigest, and LDAP can be used.

For example, to provide the /server-status and /server-statistics directories with basic authentication via .htpasswd, the following entry is required in 05-auth.conf:

auth.backend = "htpasswd"
auth.backend.htpasswd.userfile = "/etc/lighttpd/htpasswd"
auth.require                 = ( "/server-status" =>
                                ( 
                                  "method"  => "basic",
                                  "realm"   => "server status",
                                  "require" => "valid-user"
                                ),
                                "/server-info" =>
                                ( 
                                  "method"  => "digest",
                                  "realm"   => "server info",
                                  "require" => "valid-user"
                                )
                              )

7. Install WordPress with Lighttpd

If you want to learn the steps to install some CMS platforms using Lighttpd like WordPress, here is the article to follow:

How to install WordPress on Lighttpd web server while for more information check the official documentation.

Other Items:

How to Install ownCloud on Ubuntu 22.04 LTS
How to Install MediaWiki on Ubuntu 22.04 LTS
Install Jitsi Meet on Ubuntu 22.04 LTS Jammy
How to Install Vaultwarden on Ubuntu 22.04 LTS

Comments are closed.