In this article, we will have explained the necessary steps to install and configure Lighttpd on CentOS 8. 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 CentOS 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Install Lighttpd on CentOS system.
Run the following command to install Lighttpd web server:
sudo dnf install lighttpd
After successfully install Lighttpd, issue the commands below to start and enable the service to automatically start at boot time:
sudo systemctl start lighttpd sudo systemctl enable lighttpd
Check the version of the Lighttpd server installed with the command:
Once done, now you need to allow HTTP and HTTPS traffic on your firewall:
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
Then, open a web browser and go to
http://localhost if you installed locally or
http://your-server-ip-address if you installed remotely.
Step 3. Install PHP and PHP-FPM with FastCGI.
Install PHP and PHP-FPM packages using the
sudo dnf install php php-fpm lighttpd-fastcgi php-mysqlnd php-pdo php-gd php-mbstring
Next, edit the configuration ‘
Change the default ‘user’ and ‘group’ to Lighttpd:
user = lighttpd group = lighttpd
Also, change the default PHP-FPM listen using the local IP address with port ‘9000’:
listen = 127.0.0.1:9000
Next, edit the PHP configuration ‘
/etc/php.ini‘ using nano editor:
Uncomment the following line to get support with the PHP-CGI for the Lighttpd web server:
Save and close the file., restart Lighttpd and PHP-FPM service to apply all the configuration changes:
sudo systemctl restart lighttpd sudo systemctl restart php-fpm
Congratulation, you have learned how to install and configure Lighttpd web server on CentOS 8. If you have any questions, please leave a comment below.