Comments on Creating Simple Virtual Hosts With mod_mysql_vhost On Lighttpd (Debian Etch)
This guide explains how you can use mod_mysql_vhost to create simple virtual hosts on a lighttpd web server on Debian Etch. With mod_mysql_vhost, lighttpd can read the vhost configuration from a MySQL database. Currently, you can store the domain and the document root in the MySQL database which results in very simple virtual hosts. If you need more directives for your vhosts, you'd have to configure them in the global section of lighttpd.conf, which means they'd be valid for all vhosts. Therefore, mod_mysql_vhost is ideal if your vhosts differ only in the domain and document root.
1 Comment(s)
Comments
If the url contains port numbers like "http://howtoforge.com:80/index.html", lighttpd will lookup the database with the port number. To ignore this, use
"SELECT docroot FROM domains WHERE domain= SUBSTRING_INDEX('?', ':', 1);"
as sql statement.
You also can add a new column into the database table with the port number to separate the docroots for different ports.
"SELECT docroot FROM domains WHERE domain = SUBSTRING_INDEX('?', ':', 1) AND port = SUBSTRING_INDEX('?', ':', -1);"
Greets, Sannny