Lighttpd
Webserver Installation in Debian
What is Lighttpd ?
Security, speed, compliance, and flexibility--all of these
describe LightTPD 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, CGI, Auth,
Output-Compression,URL-Rewriting and many more) LightTPD is the
perfect solution for every server that is suffering load
problems. And best of all it's Open Source licensed under the
revised BSD license.
What's with the name?
Light footprint + httpd = LightTPD
Lighttpd Features
Advanced Features:
virtual hosts
virtual directory listings
URL-Rewriting, HTTP-Redirects
automatic expiration of files
Large File Support (64bit fileoffsets)
Ranges (start-end, start-, -end, multiple ranges)
on-the-fly output-compression with transparent caching
deflate, gzip, bzip2
authentication
basic, digest
backends: plain files, htpasswd, htdigest, ldap
fast and secure application controlled downloads
Server Side Includes
User Tracking
FastCGI, CGI, SSI
PHP-Support:
same speed as or faster than apache + mod_php4
includes a utility to spawn FastCGI processes (neccesary for PHP
4.3.x)
via FastCGI and CGI interface
support Code Caches like Turckmm, APC or eaccelarator
load-balanced FastCGI
(one webserver distibutes request to multiple PHP-servers via
FastCGI)
Security features:
chroot(), set UID, set GID
protecting docroot
strict HTTP-header parsing
Lighttpd Supported platforms
Releases of lighttpd are built regulary for at least the
following platforms
Linux (binary packages for FC3, SuSE, Debian, Gentoo, PLD-Linux,
OpenWRT)
*BSD (FreeBSD, NetBSD, OpenBSD, MacOS X)
SGI IRIX
Windows (Cygwin)
while it is known to compile cleanly on
Solaris
AIX
and various other POSIX compatible OSes
Download Lighttpd
http://www.lighttpd.net/download/
Lighttpd
Documentation
http://trac.lighttpd.net/trac/wiki/TutorialInstallation
Lighttpd FAQ
http://trac.lighttpd.net/trac/wiki/FrequentlyAskedQuestions
Install Lighttpd in
Debian
First, check of the requirements are ok
# apt-get install libpcre3
# apt-get install zlib1g
# apt-get install mysql-common libmysqlclient12
Go to
http://www.lighttpd.net/download/ and download the
debian package for your distribution/platform.
# wget http://www.lighttpd.net/download/debian/sarge/lighttpd_1.4.3-1_i386.deb
# dpkg -i lighttpd_1.4.3-1_i386.deb
If there is no debian package for your platform you have to
compile it yourself.
If you run unstable (Check you sources.list is configured for
unstable),then you can install it via apt:
# apt-get update
# apt-get install lighttpd lighttpd-doc
This will install lighttpd in debian
Configuring lighttpd
Following are important files for lighttpd server:
The default lighttpd configuration file: /etc/lighttpd/lighttpd.conf
(download sample
lighttpd.conf file)
Service startup script: /etc/init.d/lighttpd (download sample
lighttpd file)
These files are installed by default for all binary
installations methods. Now lighttpd installed and it is time to
configure lighttpd.
Understanding core lighttpd Directives
Following are core lighttpd Directives:
server.document-root = “/var/www/html”: Specifies default
document-root for your server.
server.port = 80: Specifies default http port for your server.
server.username = “lighttpd”
server.groupname = “lighttpd”: Specifies default username and
groups to start/stop lighttpd server. This is a security feature
(as it drops root privileges).
server.bind = “server-ip-address”: Specify server ip-address.
You can also specify hostname such as theos.in.
server.tag =”lighttpd”: Use to setup lighttpd name and version
number (default). This is security feature. You can setup it as
follows:
server.tag =”myWebServer v1.0
server.errorlog = “/var/log/lighttpd/error.log”: Specify the
error-log file.
accesslog.filename = “/var/log/lighttpd”: Specify the accesslog
file name (use to generate stats using stats software).
index-file.names = ( “index.php”, “index.html” ): A list of
files to search for if a directory is requested.
server.modules = (
“mod_access”,
“mod_accesslog”,
“mod_fastcgi”,
“mod_rewrite”,
“mod_auth”
): Above modules are loaded by lighty:
mod_access: The access module is used to deny access to files
with given trailing path names.
mod_accesslog: Use to write CLF log, flexible like apache
mod_fastcgi : FastCGI for perl/PHP etc
mod_rewrite : Good for writing SEO urls
mod_auth: Authntication (password protected directory)
mimetype.assign = (
“.pdf” => “application/pdf”,
“.sig” => “application/pgp-signature”
): Use to setup mimetype mapping.
If you want more available server modules and options check
here
Open file /etc/lighttpd/lighttpd.conf and setup all of the above
directives:
# vi /etc/lighttpd/lighttpd.conf
Save the file and start the lighttpd:
# /etc/init.d/lighttpd start
Verify that lighttpd is running:
# netstat -ntulp
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program
name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 29855/sshd
tcp 0 0 23.11.13.81:80 0.0.0.0:* LISTEN 5866/lighttpd
Open you webbrowser and test by typing URL: http://your-domain.com/
or http://server-ip/
Main Source of article can be found
here