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
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

6 Comments so far

  1. noob on October 12th, 2009

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

  2. prolianta on May 17th, 2010

    Good article, thanks )

  3. Lighttpd y PHP | Wiki Hosting on April 22nd, 2011

    [...] Lighttpd para trabajar con PHPInstalar Lighttpd servidor webSiga el siguiente tutorial:" Lighttpd y Centos 5 "Añadir Soporte de PHP con el servidor web LighttpdInstale lighttpd-fastcgi y php-cli# [...]

  4. ramu on August 8th, 2011

    Hi sir,

    this is ramu naidu i installed the lighttpd but unable to run the lighttpd services
    i tray to this command
    service lighttpd start
    error (server.c.722) couldn’t set ‘max filedescriptors’ Operation not permitted)

    please healp me

  5. em_pie on September 6th, 2011

    Hello,

    i’ve the same Problem, ramu descibes

    in the www i found something that has to do with SELinux Policys, but it looks like, that my CentOS 5.6 doesn’t run with it.

    Can anybody help us?

    I have to add, that my Unix-skills aren’t the best, but i want to grow with such Problems

    Greeting
    em_pie

  6. em_pie on September 6th, 2011

    Hello,

    i think, i’ve solved my Problem.

    SELinux ist still running on my system.

    This Link will help you (http://redmine.lighttpd.net/wiki/1/Docs:Performance)

    searching for “SELinux” show you the answer

    greetings from
    em_pie

Leave a reply