A faster alternative to Apache.

Jan 16, 2007 11:34 GMT  ·  By

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.

Photo Gallery (2 Images)

Open gallery