Mod vhostdb » History » Revision 6
Revision 5 (gstrauss, 2020-07-13 22:10) → Revision 6/9 (gstrauss, 2020-07-15 00:35)
h1. Virtual Host database
{{>toc}}
*Module: mod_vhostdb*
h2. Description
(since lighttpd 1.4.46)
virtual host database to provide vhost docroot
*Note:* STATUS: experimental (testing and feedback appreciated)
h2. Options
table{margin-left: 2em}.
|_.option |_. description |
| vhostdb.backend | "dbi", "ldap", "mysql", or "pgsql" |
| vhostdb.cache | caching parameters (see below) |
| vhostdb.dbi | mod_vhostdb_dbi config |
| vhostdb.ldap | mod_vhostdb_ldap config |
| vhostdb.mysql | mod_vhostdb_mysql config |
| vhostdb.pgsql | mod_vhostdb_pgsql config |
h2. 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.
h2. Examples
<pre>
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)
#)
</pre>
h2. Related modules
[[lighttpd:Docs_ModEVhost|mod_evhost]]
[[lighttpd:Docs_ModSimpleVhost|mod_simple_vhost]]
[[lighttpd:Docs_ModMySQLVhost|mod_mysql_vhost]] (deprecated; subsumed by mod_vhostdb_mysql)
[[lighttpd:Docs_ModVhostDbi|mod_dbi_vhost]] (ancient; user-contributed; YMMV)