Lighttpd and Centos 5

What is Lighttpd

“Security, speed, compliance, and flexibility — all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems.” http://www.lighttpd.net

Installing Lighttpd via Yum

Lighttpd is available via the RPMForge repositories

RPMForege i386 install

# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
# rpm -Uvh http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

RPMForge x86_64 or 64bit install

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -Uvh http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Install lighttpd

# yum install lighttpd

Configure Lighttpd to startup automatically when system starts

# chkconfig lighttpd on

Create required run directory and give user lighttpd permission. (typically if your yum install of lighttpd server is not working this is the fix to the problem)

# mkdir -p /var/run/lighttpd/
# chown lighttpd /var/run/lighttpd

Check that Apache is not running

# service httpd status
httpd is stopped

Start lighttpd server

# service lighttpd start

Lighttpd Default Paths

Directory Root (where to put your website files): /srv/www/lighttpd/

Lighttpd Config File: /etc/lighttpd/lighttpd.conf

Lighttpd log files: /var/log/lighttpd/

Lighttpd checks

Check lighttpd is listening for connections

# netstat -tap |grep lighttpd
tcp        0      0 *:http                      *:*                         LISTEN      2922/lighttpd

Verify Lighttpd config file syntax

# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK

Lighttpd Common Error with Yum Install

A common error when installing lighttpd via is:

# cat /var/log/lighttpd/error.log
(log.c.97) server started
(mod_fastcgi.c.924) bind failed for: unix:/var/run/lighttpd/php-fastcgi.socket-0 No such file or directory
(mod_fastcgi.c.1365) [ERROR]: spawning fcgi failed.
(server.c.902) Configuration of plugins failed. Going down.

The solution is:

Create required run directory and give user lighttpd permission. (typically if your yum install of lighttpd server is not working this is the fix to the problem)

# mkdir -p /var/run/lighttpd/
# chown lighttpd /var/run/lighttpd

1 Comment so far

  1. noob on October 12th, 2009

    Thanks to you, I’m now running lighttpd :)

Leave a reply