Home / Articles

Lighttpd installation

2014-05-28T04:04:00Z.

Lighttpd is a light-weight web server, suitable for serving static content. This article assumes you are going to install and configure Lighttpd on Debian GNU/Linux.

Install Lighttpd

To install Lighttpd, execute the following as root:


aptitude install lighttpd

Configure Lighttpd

The configuration file of Lighttpd is located at /etc/lighttpd/lighttpd.conf. A simple configuration looks like the following:


server.modules = (
  "mod_access",
  "mod_compress"
)

server.document-root = "/var/www"
server.error-handler-404 = "/404.html"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 9090
server.tag = ""

index-file.names = ( "index.html" )
url.access-deny = ( "~", ".inc" )

compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css",
  "text/html", "text/plain" )

# HTTPS on port 9191.
$SERVER["socket"] == ":9191"{
  ssl.engine = "enable"
  ssl.pemfile  = "/etc/lighttpd/certificates/lighttpd-ssl-bundle.pem"
}

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

Explanation of some of the configuration options:

References

Always refer to the official document for configuration syntax and options: