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 far fewer 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 expanded with modules. FastCGI, for example, enables PHP code to be executed. SCGI supplements lighty with 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, hence we don’t need any third-party repo just like Apache. Run the given single command to install this web server.

sudo apt install lighttpd -y

 

2. Start & Enable Lighttpd Service

Once the installation is completed, the user can start and enable the webserver service so that it can be started automatically even after rebooting the system or server.

sudo systemctl start lighttpd
sudo systemctl enable lighttpd

To check the status:

systemctl status lighttpd

 

3. Lighttpd Configuration 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. Numerous 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 via the webserver. Dynamic content can be generated in this way. So, this module can be activated via this command:

sudo lighty-enable-mod cgi

 

5. Access the default Lighttpd web page

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

Install Lighttpd web server on Ubuntu 22.04 LTS

 

6. HTTP authentication

To provide directories with password protection, the auth module is required and can be activated via

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

The use of .htaccess files known from Apache is unfortunately not possible with lighty. Instead, the settings must be made in the configuration file /etc/lighttpd/conf-enabled/05-auth.conf, and the webserver restarting is required.

Authentication is possible with basic and digest, whereby the backends plainhtpasswdhtdigest, and ldap can be used.

For example, to provide the directories /server-status and /server-statistics 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 using Lighttpd

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

How to install WordPress on Lighttpd web server whereas for more information see the official documentation. 

 

Other Articles:

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

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.