[Modules] questions about mod_vhosts_dbi

Hans de Groot hansg at dandy.nl
Fri Jun 16 04:23:41 EDT 2006


Hi,

I am trying to get mod_vhosts_dbi to work.

I managed to get it to connect to the database but I get this error:

[Thu Jun 15 16:16:51 2006] [error] vhost_dbi: get_path: www.debushalte.nl has more than 1 server row, failing.
[Thu Jun 15 16:16:51 2006] [notice] vhost_dbi_translate_name: no host found in database for 'www.debushalte.nl', using defaults.

I can see this in the mysql log:

060616 10:12:43    2019 Connect     vhost at server2.dandy.nl on mod_vhosts
                   2019 Query       SELECT ServerName FROM vhost_info WHERE ServerName = 'www3.debushalte.nl'

Please note I changed the httpd.conf to this:

LoadModule dbi_pool_module modules/mod_dbi_pool.so
LoadModule vhost_dbi_module modules/mod_vhost_dbi.so

PoolDbiDriver         Server2  mysql
PoolDbiHost           Server2  81.24.48.10
PoolDbiUsername       Server2  vhost
PoolDbiPassword       Server2  DarthVH200
PoolDbiDBName         Server2  mod_vhosts
PoolDbiConnMin        Server2  1
PoolDbiConnSoftMax    Server2  1
PoolDbiConnHardMax    Server2  5
PoolDbiConnTTL        Server2  30

<VirtualHost *:80>
  VhostDbiEnabled On
  VhostDbiConnName Server2
  VhostDbiQuery "SELECT ServerName, DocumentRoot, Username FROM vhost_info WHERE ServerName = &{RequestHostname}"
#  VhostDbiQuery "SELECT DocumentRoot FROM vhost_info WHERE ServerName = '&{RequestHostname}"
</VirtualHost>

I changed it for testing after I got the "more the one server row" error message but it did not help.
Als PLEASE note the ' symbol I put before the &{requeestHostname}. If I did not put it there
I got a mysql error beause there was only one ' arround the hostname.

I suspect I get the error because I have no clue what the vhost_info table should look like.
I have been searching hi and low but there does noet seem to be any information about this.
I tried the c source but I cannot find any code there that creates the table automatically.


So I created a database called mod_vhosts.

I also created a table in this database:

mysql> describe vhost_info;
+--------------+--------------+------+-----+---------+-------+
| Field        | Type         | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| ServerName   | varchar(255) | YES  |     | NULL    |       |
| Username     | varchar(50)  | YES  |     | NULL    |       |
| DocumentRoot | text         | YES  |     | NULL    |       |
+--------------+--------------+------+-----+---------+-------+

But This is just a big guess based in the select stament in de
httpd.conf


Also, suppose I discover what the table should look like, how to fill it?
I mean, should the calue voor DocumentRoot just be the document root path or should it include the full directive like in the httpd conf. 
Ie: "DocumentRoot: /var/www/html" 

What about other directives, like a redirect matchpermanent how to add those to the vhosts?

Anyhelp would be apreciated, even a link to some better documentation.

Regards,

hans de Groot








--- 
Hans de Groot 
Email: hansg at dandy.nl   www: http://www.dandy.nl




More information about the Modules mailing list