Project

General

Profile

Actions

Mod vhostdb » History » Revision 8

« Previous | Revision 8/9 (diff) | Next »
gstrauss, 2020-07-15 09:27


Virtual Host database

Module: mod_vhostdb

Description

(since lighttpd 1.4.46)

virtual host database to provide vhost docroot

Options

option description
vhostdb.backend "dbi", "ldap", "mysql", or "pgsql"
vhostdb.cache caching parameters (see below) (since 1.4.56)
vhostdb.dbi mod_vhostdb_dbi config
vhostdb.ldap mod_vhostdb_ldap config
vhostdb.mysql mod_vhostdb_mysql config
vhostdb.pgsql mod_vhostdb_pgsql config

Caching

vhostdb.cache = ("max-age" => "600") (default: inactive; no caching) (since lighttpd 1.4.56)
cache docroot in memory to reduce load on the backend. max-age is in seconds. cache is checked for expiration every 8 seconds, so actual caching may be up to 8 seconds longer than configured max-age.

Examples

server.modules += ( "mod_vhostdb" )

# DBI
#server.modules += ( "mod_vhostdb_dbi" )
#vhostdb.backend = "dbi" 
#vhostdb.dbi += (
#      # required
#      "sql"           => "SELECT docroot FROM vhosts WHERE host='?'",
#      "dbtype"        => "pgsql",       # DBI database driver string name
#      "dbname"        => "lighttpd",
#      # optional
#      "username"      => "lighttpd",    # (some dbtype do not require username, e.g. sqlite)
#      "password"      => "",            # (default: empty)
#      "socket"        => "/path/sock",  # (default: dbtype default)
#      "host"          => "localhost",   # (if set, overrides "socket")
#      "port"          => 5432,          # (default: dbtype default)
#      "encoding"      => "UTF-8",       # (default: dbtype default)
#)

# LDAP
#server.modules += ( "mod_vhostdb_ldap" )
#vhostdb.backend = "ldap" 
#vhostdb.ldap += (
#      # required
#      "host"          => "localhost",
#      "filter"        => "(vhost=?)",
#      "base-dn"       => "dc=my-domain,dc=com", # base distinguished name
#      # optional
#      "attr"          => "documentRoot",# (LDAP attribute with docroot; default "documentRoot")
#      "bind-dn"       => "uid=admin,dc=my-domain,dc=com", # distinguished name to which to bind
#      "bind-pw"       => "mysecret",    # password associated with bind-dn
#      "ca-file"       => "",            # certificate authority file
#      "starttls"      => "enable",      # require TLS
#      "timeout"       => "2000000",     # network timeout in microseconds (2000000 us = 2 sec) (OpenLDAP-specific) (since 1.4.56) 
#)

# MySQL/MariaDB
#server.modules += ( "mod_vhostdb_mysql" )
#vhostdb.backend = "mysql" 
#vhostdb.mysql += (
#      # required
#      "sql"           => "SELECT docroot FROM vhosts WHERE host='?'",
#      "dbname"        => "lighttpd",
#      "user"          => "lighttpd",
#      # optional
#      "password"      => "",            # (default: empty)
#      "socket"        => "/path/sock",  # (default: mysql default)
#      "host"          => "localhost",   # (if set, overrides "socket")
#      "port"          => 3306           # (default: 3306)
#)

# Postgres
#server.modules += ( "mod_vhostdb_pgsql" )
#vhostdb.backend = "pgsql" 
#vhostdb.pgsql += (
#      # required
#      "sql"           => "SELECT docroot FROM vhosts WHERE host='?'",
#      "dbname"        => "lighttpd",
#      "user"          => "lighttpd",    # (required unless dbname is a pgsql conninfo URI)
#      # optional
#      "password"      => "",            # (default: empty)
#      "host"          => "localhost",
#      "port"          => 5432           # (default: 5432)
#)

Related modules

mod_evhost
mod_simple_vhost

mod_mysql_vhost (deprecated; subsumed by mod_vhostdb_mysql)
mod_dbi_vhost (ancient; user-contributed; YMMV)

Updated by gstrauss over 3 years ago · 8 revisions