Learn How To Install Lighttpd (LLMP Stack) on CentOS 6

August 17, 2019

Table of Contents


Lighttpd is a fork of Apache aimed to be much less resource-intensive. It is lightweight, hence it’s name, and is quite simple to use. Installing it is easy, and requires root access.

In this tutorial we’ll be installing Lighttpd and PHP5, then configuring both of them to work together.

Updating your libraries

Before we begin, we must update our “yum” database. Also, since Lighttpd isn’t officially in the CentOS repositories, we must add the repository manually.

yum update
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm

Removing other installed web servers

If you have any other web servers installed, such as Apache, it is best to disable or uninstall them now. These servers will interfere with Lighttpd on the port level because two applications cannot bind to the same port.

service httpd stop
chkconfig httpd off
yum remove httpd

Installing Lighttpd

Install the web server.

yum install lighttpd

Enable Lighttpd to run at startup.

chkconfig lighttpd on 

Start the web server.

service lighttpd start

You will now be able to access your webserver by navigating to the IP address of your IT Web Services VPS. For example, http://[SERVER_IP]/ (replace SERVER_IP accordingly).

Installing PHP

Install PHP using yum.

yum install lighttpd-fastcgi php-fpm

Configure PHP-FPM user settings.

vi /etc/php-fpm.d/www.conf

We must add the following lines to the either the top or bottom of the configuration:

user = lighttpd
group = lighttpd

Make PHP-FPM start on boot.

php-fpm on

Start PHP-FPM.

service php-fpm start

Configure php.ini.

vi /etc/php.ini

Remove the commenting on the following line.


Tell Lighttpd that PHP exists on this server.

vi /etc/lighttpd/modules.conf

Add the following line.

include "conf.d/fastcgi.conf"

Now we must tell PHP to listen on port 9000 (Lighttpd will send PHP requests there). Using your favorite text editor, edit the fastcgi configuration.

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

At the top of the configuration, add the following lines of code.

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

Restart PHP-FPM and Lighttpd for our changes to take effect.

service php-fpm restart
service lighttpd restart

Congratulations! You have successfully installed Lighttpd and PHP.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!