User Tools

Site Tools


apachevhosts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

apachevhosts [2012/01/14 03:51] (current)
0.0.0.0 created
Line 1: Line 1:
 +**DRAFT**
  
 +=====  Table Definitions  =====
 +
 +  -  vhost_directives (for apache <directive> definitions per vhost)
 +    *  id(int)
 +    *  parent(int)
 +    *  directive(varchar)
 +    *  value(varchar)
 +  -  vhost_settings (for apache "Key Value" definitions per vhost)
 +    *  id(int)
 +    *  directive_id(int)
 +    *  position(int)
 +    *  key(varchar)
 +    *  value(varchar)
 +  -  vhost_fragments (for complete default code snippets that may occure in every vhost) can be used to enable/disable complete "features" of a vhost
 +    * id(int)
 +    * name(varchar)
 +    * code(text)
 +
 +=====  Sample data  =====
 +
 +{| border="1" cellpadding="2"
 +|+vhost_directives
 +|-
 +! id !! parent !! directive !! value
 +|-
 +| 1 || NULL || VirtualHost || *:80
 +|-
 +| 2 || 1 || IfModule || mod_rewrite.c
 +|} 
 +
 +{| border="1" cellpadding="2"
 +|+vhost_settings
 +!id !! directive_id !! key !! position !! value
 +|-
 +|1 || 1 || ServerName || 1 || schiffbauer.net
 +|-
 +|2 || 1 || DocumentRoot || 2 || /home/htdocs/schiffbauer.net/
 +|-
 +|3 || 2 || RewriteEngine || 1 || On
 +|-
 +|4 || 2 || RewriteRule || 2 || ^/logs[[/]]*$ /cgi-bin/awstats.pl [[R]]
 +|}
 +
 +=====  Pseudo code  =====
 +vhost generation:
 +<code>
 +$vhosts = SELECT * FROM vhost_directives WHERE directive="VirtualHost";
 +foreach $vhosts as $vhost {
 +<code>
 +  start_vhost();
 +  $settings = SELECT * FROM vhost_settings WHERE directive_id=$vhost[['id']];
 +  add_settings($settings);
 +  $directives = SELECT * FROM vhost_directives WHERE parent=$vhost[['id']];
 +  foreach $directives as $directive {
 +    start_directive();
 +    $sub_settings = SELECT * FROM vhost_settings WHERE directive_id=$directive[['id']] ORDER by position;
 +    add_settings($sub_settings);
 +    end_directive();
 +  }
 +  end_vhost();</code>
 +}
 +</code>
 +
 +=====  Config result  =====
 +<code>
 +<VirtualHost *:80>
 +<code>
 +  ServerName schiffbauer.net
 +  DocumentRoot /home/htdocs/schiffbauer.net/
 +  <IfModule mod_rewrite.c>
 +    RewriteEngine On
 +    RewriteRule ^/logs[[/]]*$ /cgi-bin/awstats.pl [[R]]
 +  </IfModule></code>
 +</VirtualHost>
 +</code>
 +
 +--[[User:Mschiff|mschiff]] 11:47, 10 Jun 2005 (CEST)
apachevhosts.txt ยท Last modified: 2012/01/14 03:51 by 0.0.0.0