In this article, we will have explained the necessary steps to install and configure Lighttpd on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Lighttpd is a “secure, fast, compatible, and very flexible” web server optimized for high-performance environments. It consumes very few resources compared to other web servers and especially fast for running AJAX applications. Lighttpd comes with a rich set of features, such as FastCGI, SCGI, Auth, URL-Rewriting, Output-Compression, event mechanism, and more.
Install Lighttpd on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
Step 2. Install Lighttpd on Ubuntu.
Run following command to install Lighttpd web server:
Once successfully install Lighttpd, start and enable the service to automatically start at boot time:
Then, open a web browser and go to
http://localhost if you installed locally or
http://your-server-ip if you installed remotely.
Step 3. Adding PHP support to Lighttpd on Ubuntu.
The first step is to install PHP and some of its modules, to do this, use the following command:
By default, PHP-FPM listens on the UNIX socket
/var/run/php74-fpm.sock. So, we will need to modify the file
/etc/php/7.4/fpm/pool.d/www.conf and set PHP-FPM to listens on TCP socket:
Then you have to make other changes in another configuration file. So, open the file
Save and close the file. Then, enable FastCGI and FastCGI-PHP modules with the following command:
Finally, restart Lighttpd and PHP-FPM service to apply all the configuration changes:
Step 4. Configure Firewall
Issue the following commands to allow HTTP (80) and HTPPS (443) request through the firewall:
That’s all you need to do to install Lighttpd on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.