Server Topic
   >  Introduction to Webservers
   >  Installing the Webserver
   >  Controlling the Webserver
   >  Installing PHP Support
   >  Using PHP
   >  Installing mySQL Database
   >  Using mySQL


Installing and Configuring the Lighttpd Webserver

Installing the Lighttpd Webserver

The Lighttpd webserver can be installed from the command line with a single command in Ubuntu:

sudo apt-get install lighttpd

Note: if this fails, try it again after running sudo apt-get update

For Fedora, there is slightly more typing required:

$ yum install lighttpd lighttpd-fastcgi
$ chkconfig --levels 235 lighttpd on

Note: the chkconfig command adds the webserver as a service at run levels 2,3 and 5

Note: if the lighttpd-fastcgi is not found, try the following command instead:

$ yum install

Once installed, that is it! The webserver will be running and you only need to configure it if the defaults do not suit you!

Configuring the Lighttpd Webserver

Configuration changes are made by updating the Lighttpd configuration file. Like most things on Linux, this is a simple text file and by default it is /etc/lighttpd/lighttpd.conf; however, this can be overridden when you launch lighttpd using the -f option.

This file can be as simple or complex as you'd like to make it. Here is an example of a simple one that configures the webserver to listen on port 1234 and enables PHP support

# define the top level web directory (web root)
server.document-root = "/var/www/webroot/" 

# define the port the webserver will listen on
server.port = 1234

# define the MIME type mapping for various types of file
mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".js" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png", 
  ".css" => "text/css" 

server.modules = (

# configure the webserver to deal with PHP code
fastcgi.server = ( ".php" => (( 
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php.socket" 

# do not allow users to see the source of these types of file
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )

# set up the initial page displayed, if the user does not specify one
index-file.names = ( "index.html", "index.htm", "index.php" )

If you need to change the default configuration, please read through the references below, which describe the basic configuration and the options available.

HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button