From OrganicDesign Wiki
| Organic Design uses a single virtual host container to handle all our hosted sites and wikis by rewriting the requested URL to an internal filesystem path which includes the domain name. This means we can add new domains or modify existing domains and the applications they map to dynamically without ever changing our virtual host configuration or restarting the web-server. This is the content of the current virtual-host file we're using which simply replaces the content of the one installed by default in /etc/apache2/sites-available/default.
|
|
|
| Note about IP Addresses
The first virtual host container is for our subversion repositories which are used to backup and locally maintain the main file structure used by the OD/Wikia, Peerix and Peerd development. Currently svn.organicdesign.co.nz uses the 209.40.203.39 IP address, the Organic Design web sites use 209.40.202.39 and the production sites use 64.79.219.166. The only reason the svn is on a different IP than the other Organic Design sites is because I couldn't work out how to set it up in the virtual hosts configuration!
|
|
NameVirtualHost 209.40.203.39:*
<VirtualHost 209.40.203.39:*>
ServerName svn.organicdesign.co.nz
<Location />
DAV svn
SVNParentPath /var/svn
</Location>
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/domains
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule ^ /%2/wiki/index.php/Main_Page [L]
RewriteCond %{REQUEST_URI} ^/files/thumb/./../.+?/[0-9]+px-
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule ^.+/(.+?)/([0-9]+)px- /%2/wiki/thumb.php?w=$2&f=$1 [L]
RewriteCond %{REQUEST_URI} ^/(wiki/|files/|[fF]avicon.ico|[rR]obots.txt)
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule (.*) /%2$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule (.*) /%2/wiki/index.php$1 [L]
</VirtualHost>
Listen 443
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot /var/www/domains
SSLEngine on
SSLCertificateFile /var/www/www.organicdesign.co.nz.pem
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule ^ /%2/wiki/index.php/Main_Page [L]
RewriteCond %{REQUEST_URI} ^/files/thumb/./../.+?/[0-9]+px-
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule ^.+/(.+?)/([0-9]+)px- /%2/wiki/thumb.php?w=$2&f=$1 [L]
RewriteCond %{REQUEST_URI} ^/(wiki/|files/|[fF]avicon.ico|[rR]obots.txt)
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule (.*) /%2$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.|wiki\.)?(.+)$
RewriteRule (.*) /%2/wiki/index.php$1 [L]
</VirtualHost>