Creating Advanced MySQL-Based Virtual Hosts On Lighttpd (Ubuntu 12.04)

This guide explains how you can create advanced virtual hosts on a lighttpd web server on Ubuntu 12.04 that are stored in a MySQL database. The method described here does not use the lighttpd mod_mysql_vhost module, and unlike mod_mysql_vhost (which allows you to store only the hostname and document root of a vhost in a database), this method allows to store individual configuration directives for each vhost in the MySQL database.