Lighttpd

From Q
Revision as of 16:14, 27 July 2011 by Tgurr (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

Lightwight alternative to the allmighty Apache.

Dependencies

USE-Flags

Packages

Code: emerge lighttpd -pv
[ebuild  N    ] www-servers/lighttpd-1.4.23  USE="bzip2 gdbm ipv6 pcre ssl -doc -fam -fastcgi -ldap -lua -memcache -minimal -mysql -php -rrdtool -test -webdav -xattr" 627 kB

Installation

# emerge lighttpd

Configuration

Setting up authentification

File: /etc/lighttpd/lighttpd.conf
server.modules = (
    "mod_auth",
)

auth.backend               = "plain"
auth.backend.plain.userfile = "/var/www/localhost/lighttpd.user"

auth.require               = ( "/" =>
                              (
                                "method"  => "basic",
                                "realm"   => "Restricted Area",
                                "require" => "user=admin"
                              )
                             )
File: /var/www/localhost/lighttpd.user
admin:xxxxx

Enabling CGI Support and rrd file processing

File: /etc/lighttpd/lighttpd.conf
server.modules = (
    "mod_alias",
)

# uncomment for cgi support
include "mod_cgi.conf"
File: /etc/lighttpd/mod_cgi.conf
$HTTP["url"] =~ "^/cgi-bin/" {
    # disable directory listings
    dir-listing.activate = "enable"
    # only allow cgi's in this directory
    cgi.assign = (
                ".pl"   =>      "/usr/bin/perl",
                ".cgi"  =>      "/usr/bin/perl",
                ".rrd"  =>      "/usr/bin/rrdcgi"
        )
}
# mkdir -p /var/www/localhost/cgi-bin
# chown -R lighttpd:root /var/www/localhost/cgi-bin

Finalize

# /etc/init.d/lighttpd start
# rc-update add lighttpd default