How To Install Lighttpd (LLMP Stack) on CentOS 6


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 updatewget -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 stopchkconfig httpd offoryum 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 Vultr 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 = lighttpdgroup = 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 restartservice lighttpd restart

Congratulations! You have successfully installed Lighttpd and PHP.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.