# lighttpd configuration file
#
# use a it as base for lighttpd 1.0.0 and above
#
#%%  Options you really have to take care of
#%
# modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.dir-listing = "disable"
server.modules = ( "mod_rewrite",
                   "mod_access",
                   "mod_fastcgi",
                   "mod_compress",
                   "mod_accesslog")
#%% a static document-root, for virtual-hosting take look at the
#% server.virtual-* options
server.document-root  = "/home/[user home]/sisu_www/"
#server.document-root        = "/home/*username*/web/public/"
## 'Parent' domain on any server except davie.
#server.document-root = "/home/*username*/public_html/"
##'Parent' domain for those of you currently on davie.textdrive.com, and all future servers.
#server.document-root = "/home/*username*/web/public/"
#% where to send error-messages to
server.errorlog       = "/home/[*username*]/var/lighttpd/log/lighttpd.error.log"
#% files to check for if .../ is requested
server.indexfiles  = ( "index.php", "index.html",
                       "index.htm", "index.rb")
##% mimetype mapping
##include "mime.types.conf"
##include_shell "/usr/local/bin/confmimetype /etc/mime.types"
#% mimetype mapping
mimetype.assign    = (
  ".pdf"           =>      "application/pdf",
  ".gz"            =>      "application/x-gzip",
  ".tar.gz"        =>      "application/x-tgz",
  ".tgz"           =>      "application/x-tgz",
  ".zip"           =>      "application/zip",
  ".gif"           =>      "image/gif",
  ".jpg"           =>      "image/jpeg",
  ".jpeg"          =>      "image/jpeg",
  ".png"           =>      "image/png",
  ".css"           =>      "text/css",
  ".html"          =>      "text/html",
  ".htm"           =>      "text/html",
  ".js"            =>      "text/javascript",
  ".text"          =>      "text/plain",
  ".txt"           =>      "text/plain",
  ".s1"            =>      "text/plain",
  ".s2"            =>      "text/plain",
  ".s3"            =>      "text/plain",
  ".dtd"           =>      "text/xml",
  ".xml"           =>      "text/xml",
  ".odt"           =>      "application/vnd.oasis.opendocument.text",
  ".bz2"           =>      "application/x-bzip",
  ".tbz"           =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"       =>      "application/x-bzip-compressed-tar"
 )
# text/x-server-parsed-html
#%Server ID Header
server.tag         = "lighttpd | TextDriven"
#%### accesslog module
accesslog.filename = "/home/[*username*]/var/lighttpd/log/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" )

#%% Options that are good to be but not neccesary to be changed
##% bind to port (default: 80)
server.port                = 8111
#server.port                = 8111
#server.port        =  8965
##% bind to localhost (default: all interfaces)
server.bind                = "localhost"
#server.bind                = "corundum"
##server.bind                = "grisu.home.kneschke.de"
##% to help the rc.scripts
server.pid-file    = "/home/[*username*]/var/lighttpd/run/lighttpd.pid"
#$HTTP["host"] =~ "\.corundum\.(name|com|net|org)" {
$HTTP["host"] == "localhost" {
  server.document-root = "/home/[*username*]/sisu_www/"
  server.errorlog = "/home/[*username*]/var/lighttpd/log/lighttpd-error.log"
  accesslog.filename = "/home/[*username*]/var/lighttpd/log/access_log"
  url.rewrite-repeat = (
    "^.*/$"                       => "index.html",
    "^(.*/(landscape|portrait))$" => "$1.pdf",
    "^(.*/(opendocument))$"       => "$1.odt",
    "^(.*/(sax|dom))$"            => "$1.xml",
    "^([^.]+)$"                   => "$1.html"
  )
  server.error-handler-404 = "/dispatch.fcgi"
#  fastcgi.server = ( ".fcgi" =>
#    ( "localhost" =>
#       (
#         "socket"   => "/home/[*username*]/var/lighttpd/cgi/lighttpd-fcgi.socket",
#         "bin-path" => "/home/[*username*]/var/lighttpd/public/dispatch.fcgi",
#         "min-procs" => 1,
#         "max-procs" => 2,
#         "idle-timeout" => 60
#       )
#    )
#  )
}
#% change uid to <uid> (default: don't care)
server.username            = "[*username*]"
#% change uid to <uid> (default: don't care)
server.groupname           = "[*username*]"
#%## compress module
compress.cache-dir         = "/home/[*username*]/var/lighttpd/cache/compress/"
compress.filetype          = ("text/plain", "text/html")
