In this article, we will have explained the necessary steps to install and setup Lighttpd on Debian 10. 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 free, open-source and high-performance web server developed by Jan Kneschke. It has a low memory footprint when compared to other web servers and is specially designed for speed-critical environments. It is secure, fast, and can handle up to 10,000 connections in parallel on a single server. Lighttpd comes with a rich set of features, such as FastCGI, SCGI, Auth, URL-Rewriting, Output-Compression, event mechanism, and more.
Install Lighttpd on Debian 10
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
Step 2. Install Lighttpd on Debian 10.
Install Lighttpd from the Debian repository using the apt package manager:
After successfully install Lighttpd, start and enable the service to automatically start at boot time:
Once it has been installed, we will be able to check the operation of it, opening a web browser and going to http://YOUR_SERVER_IP or http://localhost if we are in a local machine. Remember that this works through port 80 and it has to be available.
Step 3. Enabling the PHP support to Lighttpd.
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/php73-fpm.sock. So, we will need to modify the file
/etc/php/7.3/fpm/pool.d/www.conf and set PHP-FPM to listens on TCP socket:
Save and close the file. Next, open the file 15-fastcg-php.conf to enable FastCGI support in Lighttpd:
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:
Congratulation, you have learned how to install and configure Lighttpd on Debian Buster. If you have any question, please leave a comment below.