summaryrefslogtreecommitdiff
path: root/doc/mysqlvhost.txt
blob: 9a869a19a832593a03ccb4a3bf9deb5dac61c27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
====================
MySQL-based vhosting
====================

-----------------------
Module: mod_mysql_vhost
-----------------------

:Author: ada@riksnet.se
:Date: $Date: 2004/08/29 09:43:49 $
:Revision: $Revision: 1.1 $

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

.. meta::
  :keywords: lighttpd, mysql, vhost

.. contents:: Table of Contents

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

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

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

Options
=======

Example: ::

  mysql-vhost.db             = "lighttpd"
  mysql-vhost.user           = "lighttpd"
  mysql-vhost.pass           = "secret"
  mysql-vhost.sock           = "/var/mysql.lighttpd.sock"
  mysql-vhost.sql            = "SELECT docroot FROM domains WHERE domain='?'"


MySQL 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/');