Redhat Enterprise Linux 5 – lighttpd 1.5.0 installation

by on April 2, 2007 · 10 comments· LAST UPDATED April 9, 2007

in , ,

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

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 10 comments… read them below or add one }

1 g12 June 8, 2007 at 6:44 am

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.

Reply

2 nixCraft June 8, 2007 at 9:15 am

Make sure apache is not running on Port 25. Type command
/etc/init.d/httpd stop
Try again.

Reply

3 André June 21, 2007 at 11:59 pm

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…

Reply

4 Eric July 13, 2007 at 5:25 pm

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

Reply

5 Chris August 22, 2007 at 9:35 pm

I am getting this
[root@srv01 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.

Reply

6 josh April 18, 2008 at 4:59 pm

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 ?

Reply

7 bihag April 28, 2008 at 12:52 pm

Hi,

Thanks a lot for this artical, I successfully installed in RHEL 5

Thanks again ….

Reply

8 LF June 15, 2008 at 12:05 am

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?

Reply

9 r3n0x March 2, 2009 at 5:27 am

Hi everbody,

Anyone know how to upgrade from lighttpd 1.4.7 to 1.5.0 on a DNS-323 NAS?

Let me know please!!

Reply

10 bilal March 17, 2011 at 11:36 pm

how about a debian version of this tutorial please? the init.d file and spawn-fcgi etc…

thanks

Reply

Leave a Comment

Previous post:

Next post: