Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home > News > Linux > Other Tips, Tricks and Tutorials

January 16th, 2007, 11:34 GMT · By Mihai Marinof

Installing Lighttpd on Fedora and Ubuntu

SHARE:

Adjust text size:


I've always wanted to have a spare alternative to everything, just in case something goes wrong with the first, I could always fall back to second, third and so on, and I'm pretty sure I'm not the only one who likes it this way. When you think about a web server for Linux, you'll undoubtedly think about Apache. Why? Either because it's the only web server application you've worked with, or thanks to its constantly increasing popularity level due to the fact that most (if not all) Linux distributions are released with Apache pre installed by default. Or because you're simply not aware of other web server applications, besides Apache. In that case, you'll be pleased to know that there's an alternative to the popular webserver and it's called lighttpd, which meets and probably even exceeds Apache's capabilities.

Lighttpd (light footprint + httpd) is a web server designed to be fast, secure, standards-compliant and flexible, while being optimized for speed-critical environments. Its memory footprint is very low compared to other web servers, while its CPU load and its speed
make lighttpd the most suitable for servers that suffer load problems. Moreover, Lighttpd is distributed under the BSD license, which makes lighttpd free.

Install lighttpd

on Fedora

- Install lighttpd through yum:
CODE
yum install lighttpd

- Stop Apache (httpd) if you have it installed and running
Also, make sure it won't auto-start at the next reboot:
CODE
service httpd stop
chkconfig httpd off

on Ubuntu

- Install lighttpd:
CODE
sudo apt-get install lighttpd

building from Source Code

- Make sure the following requirements are met:
• automake 1.8 or higher
• autoconf 2.57 or higher
• libtool 1.5 or higher

- Next, download the latest source package from SOFTPEDIA
- Open a terminal, change directory, compile and install:
CODE
tar xfz lighttpd-x.x.x.tar.gz
cd lighttpd-x.x.x
./configure
make
make install

Enable PHP support

on Fedora

- Install fastcgi mod for lighttpd:
CODE
yum install lighttpd-fastcgi

- Make sure you have php-cgi installed by typing php-cgi -v. If you get a command not found error, type:
CODE
yum install php-cli

- Open /etc/lighttpd/lighttpd.conf in your favorite editor and look for the fastcgi.server section. Uncomment the lines in that section so it will look like this:

Also, make sure that the "bin-path" is correct by running command /usr/bin/php-cgi -v. If it's wrong, run type php-cgi to get the correct one.

Note: It's possible that when you try to view a php file in lighttpd, you will get a 403 forbidden error. If you follow the above guide, that error will be remedied.

on Unbuntu

- Install PHP5-cgi:
CODE
sudo apt-get install php5-mysql

- Enable CGI for lighttpd:
CODE
sudo lighty-enable-mod cgi

Running lighttpd

on Fedora:

- Login as root and type:
(use 'restart', just in case it has been auto ran)
CODE
/etc/init.d/lighttpd restart
By default, the document root (web server directory that holds the HTML files) for lighttpd on Fedora is in /srv/www/lighttpd/.

on Ubuntu:

- Open a terminal and type:
CODE
sudo /etc/init.d/lighttpd start
By default, the document root for lighttpd on Ubuntu is in /var/www.

TELL US WHAT YOU THINK:

46,591 hits · 10 comments · Link to this article · Print article · Send to friend · Subscribe to news

MUST-READ RELATED ARTICLES:


GNU Screen Tutorial

Setting Up A Central Syslog Server

Creating a Local Update Repository for FC6

Wolfenstein: Enemy Territory Server Setup

How to Bind a Range of IPs

READER COMMENTS:


Comment #1 by: Tanthalas on 11 Sep 2008, 10:15 UTC reply to this comment

Cheers for the guide mate. Quick correction for you - you've got people installing php5-mysql on Ubuntu when you actually want them to be installing php5-cgi. The rest is good stuff though. Got me installed in 5 minutes flat. Bookmarked!


Comment #2 by: Rick on 22 Dec 2008, 19:43 UTC reply to this comment

Thank you so much for this. everything works perfectly! This should be in the lighty docs.


Comment #3 by: Stefanos Michael Sofroniou on 16 Jan 2009, 13:48 UTC reply to this comment

Fedora's default lighttpd directory is "/var/www/lighttpd". Good work mate ;)


Comment #4 by: eswar on 19 Feb 2009, 15:01 UTC reply to this comment

I will not set gid to 0


i getting this error could you please any help me out.
how to over come this issuse


Comment #5 by: John on 13 May 2009, 08:44 UTC reply to this comment

Great guide. Helped me alot.
Thank You


Comment #6 by: peter_griffin on 26 Jul 2009, 01:58 UTC reply to this comment

Hi folks,

I am facing issues installing lighttpd-1.4.23 on Ubuntu. When I do "./configure", it keeps complaining about "zlib-headers", so I went and installed the latest version of zlib (1.2.3), still the errors won't go away :(

checking for zlib support... yes
checking for deflate in -lz... no
configure: error: zlib-headers and/or libs where not found, install them or build with --without-zlib

I don't want to install without zlib either, hence the question. Thanks a lot!

Comment #6.1 by: kaptainkrunch on 06 Jun 2011, 20:53 GMT

solution:

install package zlib1g-dev


Comment #7 by: rahul on 20 Dec 2009, 11:59 UTC reply to this comment

It Works Charming Good !
Thanks A Hell ! I Am Damn Happy Today !


Comment #8 by: mr.vlatko on 04 Nov 2011, 09:33 UTC reply to this comment

Great tutorial works like charm


Comment #9 by: cskinit on 09 Dec 2011, 09:08 UTC reply to this comment

am installed lighttpd in ubuntu 11.04. create file test.php and placed in www. .php file not working return 403 forbidden error but html running, i don't know how to correct need a help thank in advance!!!

Copyright © 2001-2012 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM