From: Matthijs Kooijman Date: Wed, 17 Dec 2008 19:03:26 +0000 (+0100) Subject: lighttpd: Add initial configuration files. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;ds=sidebyside;h=b51e062dca9319e2d9fb48af845815bdbd50a5cc;p=matthijs%2Fservers%2Fdrsnuggles.git lighttpd: Add initial configuration files. --- diff --git a/etc/lighttpd/lighttpd.conf b/etc/lighttpd/lighttpd.conf new file mode 100644 index 0000000..f045f11 --- /dev/null +++ b/etc/lighttpd/lighttpd.conf @@ -0,0 +1,73 @@ +# Debian lighttpd configuration file +# + +# Chroot into our root-dir +#server.chroot = "/data/www" + +#var.root-dir = "" +var.root-dir = "/data/www" +var.conf-dir = "/etc/lighttpd" +var.fcgi-dir = var.root-dir + "/var/fcgi" + +## modules to load +server.modules = ( + "mod_access", + "mod_alias", + "mod_accesslog", + "mod_rewrite", + "mod_redirect", + "mod_evhost", + "mod_cgi", + "mod_fastcgi", + "mod_auth", +) + +# Set a default catch-all document root, which should never be used. +server.document-root = var.root-dir + "/default/htdocs" + +## where to upload files to, purged daily. +server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) + +## where to send error-messages to +server.errorlog = var.root-dir + "/default/logs/error.log" + +## files to check for if .../ is requested +index-file.names = ( "index.php", "index.html" ) + +#### accesslog module +accesslog.filename = var.root-dir + "/default/logs/access.log" + +## deny access the file-extensions +# +# ~ is for backupfiles from vi, emacs, joe, ... +# .inc is often used for code includes which should in general not be part +# of the document-root +url.access-deny = ( "~", ".inc" ) + +## +# which extensions should not be handle via static-file transfer +# +# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) + +## Use ipv6 only if available. +server.use-ipv6 = "disable" + +## to help the rc.scripts +server.pid-file = "/var/run/lighttpd.pid" + +## virtual directory listings +dir-listing.encoding = "utf-8" +# Disable dir-listing by default +server.dir-listing = "disable" + +# Don't run as root +server.username = "www-data" +server.groupname = "www-data" + +#### external configuration files +## mimetype mapping +include_shell var.conf-dir + "/scripts/create-mime.assign.pl" + +## load vhosts +include_shell var.conf-dir + "/scripts/include-vhosts.pl" diff --git a/etc/lighttpd/scripts/create-mime.assign.pl b/etc/lighttpd/scripts/create-mime.assign.pl new file mode 100755 index 0000000..1facb00 --- /dev/null +++ b/etc/lighttpd/scripts/create-mime.assign.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w + +# This script is based on /usr/share/lighttpd/create-mime-assign.pl. This +# script is changed to include a charset for text types. + +use strict; +open MIMETYPES, "/etc/mime.types" or exit; +print "mimetype.assign = (\n"; +my %extensions; +while() { + chomp; + s/\#.*//; + next if /^\w*$/; + if(/^([a-z0-9\/+-.]+)\s+((?:[a-z0-9.+-]+[ ]?)+)$/) { + my $mime = $1; my $exts = $2; + # Append encoding for text formats + if ($mime =~ /^text\//) { + $mime .= "; charset=iso-8859-1"; + } + foreach(split / /, $exts) { + # mime.types can have same extension for different + # mime types + next if $extensions{$_}; + $extensions{$_} = 1; + + print "\".$_\" => \"$mime\",\n"; + } + } +} +print ")\n"; diff --git a/etc/lighttpd/scripts/include-vhosts.pl b/etc/lighttpd/scripts/include-vhosts.pl new file mode 100755 index 0000000..ece849c --- /dev/null +++ b/etc/lighttpd/scripts/include-vhosts.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl -wl + +# This script is based on /usr/share/lighttpd/include-conf-enabled.pl but +# changed to read the vhosts directory instead of the conf-enabled directory. + +use strict; +use File::Glob ':glob'; + +my $confdir = "/etc/lighttpd/"; +my $enabled = "vhosts/*"; + +chdir($confdir); +my @files = bsd_glob($enabled); + +for my $file (@files) +{ + print "include \"$file\""; +} diff --git a/etc/lighttpd/vhosts/evolution-events-nl b/etc/lighttpd/vhosts/evolution-events-nl new file mode 100644 index 0000000..ca5e1bf --- /dev/null +++ b/etc/lighttpd/vhosts/evolution-events-nl @@ -0,0 +1,74 @@ +$HTTP["host"] =~ "^(evolution-events.nl)$" { + url.redirect = (".*" => "http://www.%1/") +} + +$HTTP["host"] =~ ".evolution-events.nl$" { + var.site-dir = var.root-dir + "/evolution-events.nl" + var.site-fcgi-dir = var.fcgi-dir + "/evolution-events-nl" + + evhost.path-pattern = var.site-dir + "/htdocs/%3/" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( + ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + "broken-scriptfilename" => "enable", + )), + "/wipi" => + (( + "socket" => var.site-fcgi-dir + "/wipi", + "check-local" => "disable", + "broken-scriptfilename" => "enable", + )), + ) + alias.url = ( + # Don't name this /wipistatic, since that will be caught by fastcgi above + "/staticwipi" => var.site-dir + "/applications/wipi/static/", + ) + + url.rewrite-once = ( + "^/wipi/static/(.*)$" => "/staticwipi/$1", + "^(/.*)$" => "$1", + ) + + $HTTP["host"] =~ "^orga.evolution-events.nl$" { + auth.backend = "plain" + auth.backend.plain.userfile = var.site-dir + "/conf/simple.user" + + auth.require = ( "/private" => + ( + "method" => "digest", + "realm" => "Evolution Events", + "require" => "user=admin" + ) + ) + + + url.rewrite-once = ( + "^/forum/(.+)$" => "/forum/", + ) + } + + $HTTP["host"] =~ "^xerxes.evolution-events.nl$" { + fastcgi.server = ( + "/blaa" => + (( + "socket" => var.site-fcgi-dir + "/xerxes", + "check-local" => "disable", + )), + ) + + alias.url = ( + "/media/" => "/home/matthijs/django/contrib/admin/media/", + "/static/" => var.site-dir + "/applications/xerxes/static/", + ) + + url.rewrite-once = ( + "^(/media.*)$" => "$1", + "^(/static.*)$" => "$1", + "^/favicon\.ico$" => "/media/favicon.ico", + "^(/.*)$" => "/blaa$1", + ) + } +} diff --git a/etc/lighttpd/vhosts/foresightsecurity-nl b/etc/lighttpd/vhosts/foresightsecurity-nl new file mode 100644 index 0000000..a3efeac --- /dev/null +++ b/etc/lighttpd/vhosts/foresightsecurity-nl @@ -0,0 +1,17 @@ +$HTTP["host"] =~ ".foresightsecurity.nl$" { + var.site-dir = var.root-dir + "/foresightsecurity.nl" + var.site-fcgi-dir = var.fcgi-dir + "/evolution-events-nl" + + evhost.path-pattern = var.site-dir + "/htdocs/%3/" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( + ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + "broken-scriptfilename" => "enable", + )) + ) + + cgi.assign = ( "cgi" => "" ) +} diff --git a/etc/lighttpd/vhosts/stderr-nl b/etc/lighttpd/vhosts/stderr-nl new file mode 100644 index 0000000..71089a9 --- /dev/null +++ b/etc/lighttpd/vhosts/stderr-nl @@ -0,0 +1,37 @@ +$HTTP["host"] =~ ".stderr.nl$" { + var.site-dir = var.root-dir + "/stderr.nl" + var.site-fcgi-dir = var.fcgi-dir + "/stderr-nl" + + evhost.path-pattern = var.site-dir + "/htdocs/%3/" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( + ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + "broken-scriptfilename" => "enable", + )) + ) + + cgi.assign = ( "cgi" => "" ) + + $HTTP["host"] =~ "git.stderr.nl$" { + # Put this alias in a url conditional, so urls like /gitweb.css won't get alias'd + $HTTP["url"] =~ "^/gitweb(/.*)?$" { + alias.url += ( "/gitweb" => "/usr/lib/cgi-bin/gitweb.cgi" ) + } + } + + $HTTP["host"] =~ "indigetes.stderr.nl$" { + auth.backend = "htpasswd" + auth.backend.htpasswd.userfile = var.site-dir + "/pandora2008.user" + + auth.require = ( + "/" => ( + "method" => "basic", + "realm" => "Di Indigetes", + "require" => "valid-user" + ) + ) + } +} diff --git a/etc/lighttpd/vhosts/stdin-nl b/etc/lighttpd/vhosts/stdin-nl new file mode 100644 index 0000000..cdec07a --- /dev/null +++ b/etc/lighttpd/vhosts/stdin-nl @@ -0,0 +1,14 @@ +$HTTP["host"] =~ ".stdin.nl$" { + var.site-dir = var.root-dir + "/stdin.nl" + var.site-fcgi-dir = var.fcgi-dir + "/stdin-nl" + + evhost.path-pattern = var.site-dir + "/htdocs/%3/" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + "broken-scriptfilename" => "enable", + )) + ) +} diff --git a/etc/lighttpd/vhosts/stdio-flexvps-nl b/etc/lighttpd/vhosts/stdio-flexvps-nl new file mode 100644 index 0000000..7152943 --- /dev/null +++ b/etc/lighttpd/vhosts/stdio-flexvps-nl @@ -0,0 +1,15 @@ +$HTTP["host"] =~ "stdio.flexvps.nl$" { + var.site-dir = var.root-dir + "/stdio.flexvps.nl" + var.site-fcgi-dir = var.fcgi-dir + "/stdio-flexvps-nl" + + server.document-root = var.site-dir + "/htdocs" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( + ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + "broken-scriptfilename" => "enable", + )) + ) +} diff --git a/etc/lighttpd/vhosts/stdout-nl b/etc/lighttpd/vhosts/stdout-nl new file mode 100644 index 0000000..224818c --- /dev/null +++ b/etc/lighttpd/vhosts/stdout-nl @@ -0,0 +1,13 @@ +$HTTP["host"] =~ ".stdout.nl$" { + var.site-dir = var.root-dir + "/stdout.nl" + var.site-fcgi-dir = var.fcgi-dir + "/stdout-nl" + + evhost.path-pattern = var.site-dir + "/htdocs/%3/" + accesslog.filename = var.site-dir + "/logs/access.log" + + fastcgi.server = ( ".php" => + (( + "socket" => var.site-fcgi-dir + "/php", + )) + ) +}