Redhat Enterprise Linux 5 – lighttpd 1.5.0 installation

Posted on in Categories Howto, lighttpd, Linux, RedHat/Fedora Linux, Tips last updated April 9, 2007

Lighttpd 1.5.0 pre release is now available for download. There are some nice and good features. Many things have been improved, changed and added. New mod-proxy-core is much better as compare to old mod-fastcgi/mod_cgi.

On other hand Redhat Enterprise Linux 5 comes with
=> PHP5 fastcgi binary (/usr/bin/php-cgi)
=> MySQL 5
=> And nice latest and stable stuff.

My old lighttpd howtos all are based upon 1.4.x series. Most of those howtos are still valid I will add only new stuff here.

Note following instructions are 100% compatible with latest version of Fedora Core and Cent OS (based upon RHEL 5.x)

Download lighttpd

Download and untar lighttpd-1.5.0-r1691.tar.gz tar ball
# cd /opt
# wget http://www.lighttpd.net/assets/2007/2/23/lighttpd-1.5.0-r1691.tar.gz
# tar -zxvf lighttpd-1.5.0-r1691.tar.gz

Install all nessary development libraries

You need to install following libraries to compile required modules and features:

  • glib2-devel : Gnome header files for version 2 of the GLib library
  • openssl-devel – Used by core and SSL support
  • pcre-devel – Used by mod_redirect, mod_rewrite,
  • bzip2-devel – Use by compress-bzip2
  • zlib-devel – Used by compress-gzip and compress-deflate. It contains the header files and libraries.

# yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel

Configure lighttpd

Configure required modules and features:
# ./configure --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-openssl

Install lighttpd

Just compile and install lighttpd:
# make
# make install

Add necessary user/group and directories

First add lighttpd user:
# adduser -m -d /var/www -s /sbin/nologin lighttpd
Next create configuration directories:
# mkdir /etc/lighttpd/
# mkdir /etc/lighttpd/ssl
# mkdir /var/log/lighttpd
# mkdir -p /var/www/html
# chown lighttpd:lighttpd /var/log/lighttpd

Lighttpd basic configuration

Now you need to create basic configuration file. Just grab my default configuration file:
# cd /etc/lighttpd
# wget http://www.cyberciti.biz/files/lighttpd/1.5.0/lighttpd.conf.txt
# mv lighttpd.conf.txt lighttpd.conf
Make changes as per your setup:
# vi lighttpd.conf
Copy lighttpd init.d file:
# cd /etc/init.d
# wget http://www.cyberciti.biz/files/lighttpd/1.5.0/lighttpd.init.d.txt
# mv lighttpd.init.d.txt lighttpd
# chmod +x lighttpd
# chkconfig on lighttpd

spawn-fcgi is used to spawn remote FastCGI processes such as php. This is a new change in this version. Both of above lighttpd init.d and lighttpd scripts are patched to support spawn-fcgi automatically.

Caution: Do not use lighttpd 1.4.x series configuration files.

Start lighttpd

My setup:
# uname -mrs
Output:

Linux 2.6.18-8.1.1.el5 x86_64

# cat /etc/redhat-release
Output:

Red Hat Enterprise Linux Server release 5 (Tikanga)

# lighttpd -v
Output:

lighttpd-1.5.0 (ssl) - a light and fast webserver
Build-Date: Mar 31 2007 13:40:13

Now start lighttpd:
# /etc/init.d/lighttpd start

Starting lighttpd: mod_proxy_core_address.c.63: (trace) adding unix:/tmp/php-fastcgi.sock to the address-pool
                                                           [  OK  ]
spawn-fcgi.c.209: child spawned successfully: PID: 6344

Make sure lighttpd is listing and bind to port 80:
# netstat -tulpn | grep :80
Output:

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      6436/lighttpd

See also

=> Feel free to browse our rich collection of lighttpd tips and howtos
=> Official Lighttpd web site

10 comment

  1. when i start lighttpd using this:
    # /etc/init.d/lighttpd start

    hey i get an error like this:

    Starting lighttpd: 2007-06-08 14:41:42: (network.c.289) can’t bind to port: 80Address already in use
    [FAILED]
    spawn-fcgi.c.230: child exited with: 126, Unknown error 126

    would you happen to know where i probably got it wrong? thanks.

  2. 2007-06-21 20:58:29: (plugin.c.165) dlopen() failed for: /usr/local/lib/mod_proxy_core.so /usr/local/lib/mod_proxy_core.so: undefined symbol: iosocket_free
    2007-06-21 20:58:29: (server.c.594) loading plugins finally failed

    I get this erros…

  3. What about using the configuration settings on a system that has a standard yum installation of an earlier version of lighttpd. Would there be collisions? Would an update to yum overwrite this installation? I just haven’t found enough information, or experience, to decipher the configure options. Any help would be appreciated. I would uninstall the standard package on my Centos, but I wonder if it would be overwritten later during a yum update.

    Thanks
    Eric

  4. I am getting this
    [[email protected] lighttpd]# service lighttpd start
    Starting lighttpd: configfile-glue.c.169: (error) found deprecated key in ‘proxy-core.check-local’ = ‘use $PHYSICAL[“existing-path”] =~ … { … } instead’
    mod_proxy_core_address.c.63: (trace) adding unix:/tmp/php-fastcgi.sock to the address-pool
    2007-08-22 23:34:03: (server.c.1474) Configuration contains deprecated keys. Going down.

  5. We are also getting this error:

    /etc/init.d/lighttpd start
    Starting lighttpd: 2008-04-18 09:52:13: (plugin.c.165) dlopen() failed for: /usr/lib/mod_proxy_core.so /usr/lib/mod_proxy_core.so: cannot open shared object file: No such file or directory
    2008-04-18 09:52:13: (server.c.621) loading plugins finally failed
    [FAILED]
    spawn-fcgi.c.89: socket is already used, can’t spawn

    What package provides mod_proxy_core.so ?

  6. Hi, sorry to bother you.. I have lighty lighttpd-1.4.19 (ssl) installed and running on my debian for mor than 6 months.

    Today I notice that its behaving very very VERY slow. I updated my apt if im not wrong on monday, and restarted lighty yesterday.

    I see no CPU usage, and memory seems like always. I thought the prob was fast-cgi, but every page even html static ones, within a few seconds after lighty is restarted it wont load, well maybe like 5 minutes later.

    Its not like a have thousands of visits… but it was good two days ago.. also browse with a anony proxy and it gives time out

    Any idea?

Leave a Comment