Lighttpd is a web server that’s fast, flexible and built with security good practices. It’s designed for high performance environments and websites with very high traffic. Lighttpd allows you to run these powerful web applications with limited footprint — .

We’ve written a lot about other webservers on this blog including Nginx and Apache2. In fact this blog ( is powered by Nginx webserver. We initially had Apache2 running our WordPress site for over two years, and just little over a year ago, we switched to Nginx.

I personally think that switching to Ngjnx was a great move as our pages are loading faster without us adding more server resources. Apache2 was great but there were some issues we couldn’t resolve so we had to switch.

This brief tutorial is going to show you how to install Lighttpd webserver in CentOS 7 with PHP5 and MariaDB support. We’re installing MariaDB database server because MySQL is no long shipping with CentOS. MariaDB is not the default database server for CentOS.

When it comes to webservers, there’s Apache2, the #1 webserver powering most websites online today, Nginx the second place holder and others, including Lighttpd.

If you think your current webserver isn’t doing you any favors, you can switch to better webservers. We did switch to Nginx because we felt Nginx was going to serve us well and we were right.

Others may think Apache2 is the favorites and most supported webserver, which is true. Those who feel that way can also switch.  So, there are many webservers out there that may be right for you and it won’t hurt to try them all in order to pick the one that works best for you.

If you wish to install and use Lighttpd in CentOS 7, continue below to learn how to.


  • Installing Lighttpd in CentOS 7

To install Lighttpd you must enable additional repositories since it isn’t available in CentOS 7 default repository. One of the repositories Lighttpd is available in is EPEL repository.

To enable EPEL in CentOS, run the commands below to download the repository file.

cd /tmp/ && wget


Next, run the commands below to install the repository

sudo yum install epel-release-7-1.noarch.rpm


After that run the commands below to install Lighttpd

sudo yum install lighttpd


To start up Lighttpd webserver, run the commands below.

sudo systemctl start lighttpd.service


  • Installing MariaDB In CentOS 7

Next, let’s install MariaDB in CentOS 7. We’re installing MariaDB because it’s the default database server in CentOS going forward. To install it in CentOS, run the commands below.

sudo yum install mariadb-server mariadb


To start the database, run the commands below.

sudo systemctl start mariadb.service


After installing the database, run the commands below to configure the database. This will allow you create a root password, remove the test database as well as remove the anonymous user.

sudo mysql_secure_installation


  • Installing PHP5 Support in CentOS 7

Finally, install PHP5 support with other PHP modules. To do that, run the commands below.

sudo yum install php lighttpd-fastcgi php-gd php-mysql php-tidy php-xmlrpc php-common php-cli php-xml


Now that all the servers are installed, it now time to begin configuring each. First, lets configure Lighttpd so that it function properly. Right now, Lighttpd should work just fine. All you have to do is allow http traffic through the firewall.

To do that, run the commands below.
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https


Reload the firewall and try connecting to the server.

sudo firewall-cmd –reload


Open your favorite web browser and connect to the server. You should see the default page for Lighttpd


lighttpd default page

The web server is working.


To verify if PHP is working, continue below.

First, open the file below and make sure the highlighted line is un-commented and value set to 1

sudo nano /etc/php.ini


Valude set as shown below.



Next,  open the file below and enable the fastcgi module.

sudo nano /etc/lighttpd/modules.conf


Then make sure to enable the module by un-commenting the line

include "conf.d/fastcgi.conf"


Finally,  at the fine of this file, uncomment the lines as shown below.

sudo vi /etc/lighttpd/conf.d/fastcgi.conf


fastcgi.server = (
".php" => ((
"host" => "",
"port" => "9000",
"broken-scriptfilename" => "enable"


Now create a test file in the root directory called phpinfo.php.

sudo vi /var/www/lighttpd/phpinfo.php


Then type the lines below into the file and save it.


Open your browser again and bring up the page and this time PHP test page should show.


lighttpd php