Lighttpd is a secure, fast, standards-compliant web server designed for speed-critical environments. This tutorial shows how you can install Lighttpd on a CentOS 5.4 server/vps with PHP5 support (through FastCGI) and MySQL support.
Lighty is not available from the official CentOS 5.4 repositories, but it is available via the RPMForge repositories.
RPMForge x86_64 or 64bit install
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
RPMForege i386 install
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Install lighttpd
yum install lighttpd
Configure Lighttpd to startup automatically when system starts
chkconfig –levels 235 lighttpd on
Starting lighttpd
/etc/init.d/lighttpd start
Installing PHP5
yum install lighttpd-fastcgi php-cli
Enabling PHP5 support in lighttpd
we should edit lighttpd’s config file and php.ini file to get PHP5 support in Lighty. Using the text editor of your choice edit /etc/php.ini
nano /etc/php.ini
and add cgi.fix_pathinfo = 1 at the end of the file.
Next we edit /etc/lighttpd/lighttpd.conf
nano /etc/lighttpd/lighttpd.conf
and in that file uncomment the mod_fastcgi (remove the # ).
and also we have to uncomment fastcgi.server
and use /tmp/php-fastcgi.socket as the socket .
Restarting Lighttpd
/etc/init.d/lighttpd restart
Installing MySQL
yum install mysql mysql-server
Configure MySQL to startup automatically when system
starts
chkconfig –levels 235 mysqld on
Starting MySQL
/etc/init.d/mysqld start
MySQL support for PHP5
yum install php-mysql
Restarting Lighty
/etc/init.d/lighttpd restart
Testing PHP5 with phpinfo
We will create a test file called info.php with the phpinfo function.
nano /srv/www/lighttpd/info.php
with the following code
<? phpinfo (); ?>

Now if php5 is installed properly , you should see a file with some info on server..and something like the one shown in the image.
Lighty Default Paths
Lighttpd Config File: /etc/lighttpd/lighttpd.conf
Directory Root : /srv/www/lighttpd/