This article is outdated and may not work correctly for current operating systems or software.
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.
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
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 or yum remove httpd
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,
Install PHP using yum.
yum install lighttpd-fastcgi php-fpm
Configure PHP-FPM user settings.
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.
service php-fpm start
Remove the commenting on the following line.
Tell Lighttpd that PHP exists on this server.
Add the following line.
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.
At the top of the configuration, add the following lines of code.
fastcgi.server += ( ".php" => (( "host" => "127.0.0.1", "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.