[Zope] Best way to run virtual web sites using Zope??

mindlace mindlace@imeme.net
Wed, 12 Apr 2000 01:45:32 -0600


Robert Geiger wrote:
> 
> I am interested in creating several web sites of the form
> 
>         Fire.mydomain.com
>         Water.mydomain.com
>         Earth.mydomain.com
>         Sky.mydomain.com
> 
> The "elements" are incidental!  I would like to keep things
> on a single server.  Can I do this??  It seems like Apache
> does this kind of thing, but I don't have much experience
> with it.

Here's how you do it with a naked (wo_pcgi) zope:
Make a SiteRoot folder with *nothing* in it (no default path) in the
root folder and in folders for your subdomains.  Then use this
access_rule:

Get subdomain:
<dtml-let
subdomain="_.string.join(_.string.split(_.string.split(HTTP_HOST,
':')[0], '.')[0], '')">
Is there a folder named as this subdomain?
  <dtml-try>
     <dtml-if "_[subdomain]">
        Set logical root: <dtml-call "REQUEST.set('SiteRootPATH', '/')">
        Add physical root: <dtml-call
"REQUEST.path.append(subdomain)">   
     </dtml-if>
   <dtml-except KeyError>
       Set logical root: <dtml-call "REQUEST.set('SiteRootPATH', '/')">
   </dtml-try>
</dtml-let>


You can host... many subdomains this way :)

Make sure your DNS lists the same address for each subdomain.

Oh, and on a random note, AccessRules *are* nestable.  That rocks.

good luck!
-- 
ethan mindlace fremen        mindlace@imeme.net
zope    -&-     imap email   -&-   mailing list
weave your web with the web at http://imeme.net