=========================
PostgreSQL-based vhosting
=========================

----------------------------
Module: mod_postgresql_vhost
----------------------------

:Author: 
:Date: $Date:  $
:Revision: $Revision: $

:abstract:
  This module provides virtual hosts (vhosts) based on a PostgreSQL table

.. meta::
  :keywords: lighttpd, postgresql, vhost

.. contents:: Table of Contents

Description
===========

With PostgreSQL-based vhosting you can store the path to a given host's
document root in a PostgreSQL database.

.. note:: Keep in mind that only one vhost module should be active at a time.
          Don't mix mod_simple_vhost with mod_postgresql_vhost.

Options
=======

Example: ::

	sql-vhost.backend       = "postgresql"
	sql-vhost.select-vhost  = "SELECT docroot FROM domains WHERE domain='?'"
	sql-vhost.cache-ttl     = 60 # Time in seconds - Default 60
	sql-vhost.debug         = 0 # Enable extra verbose debugging
	sql-vhost.db            = "lighttpd"
	sql-vhost.user          = "lighttpd"
	sql-vhost.hostname      = "/tmp"

PostgreSQL setup: ::

  GRANT SELECT ON lighttpd.* TO lighttpd@localhost IDENTIFIED BY 'secret';

  CREATE DATABASE lighttpd;

  USE lighttpd;

  CREATE TABLE domains (
    domain varchar(64) not null primary key,
    docroot varchar(128) not null
  );

  INSERT INTO domains VALUES ('host.dom.ain','/http/host.dom.ain/');



