Project

General

Profile

Virtual Host database

Module: mod_vhostdb

Description

(since lighttpd 1.4.46)

virtual host database to provide vhost docroot

Note: STATUS: experimental (testing and feedback appreciated)

Options

option description
vhostdb.backend "dbi", "ldap", "mysql", or "pgsql"
vhostdb.dbi mod_vhostdb_dbi config
vhostdb.ldap mod_vhostdb_ldap config
vhostdb.mysql mod_vhostdb_mysql config
vhostdb.pgsql mod_vhostdb_pgsql config

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
#)

# 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 5 months ago · 3 revisions