[Zope-dev] ZOPE hosting: Subsiting patch 0.5.

Andreas Kostyrka andreas@mtg.co.at
Fri, 23 Jul 1999 00:43:24 +0200 (CEST)


Hi!

I've uploaded a patch at http://www.mtg.co.at/projects/subhosting/, that
allows to host multiple websites in one ZOPE space.

This is a pure ZPublisher patch, and as such supports only subsites
that DO acquire from their mainsite. This is more or less the right thing
for logically interconnected websites, and is probably acceptable for
other uses too. The patch supports at ZPublisher level also nonacquiring
subsites, but at the moment this is not functional, because there are no
Application-alike objects yet (normal Folders don't work permissionwise,
and creating an additional Application does neither :( ).

I've included the README file for the patch here:
ZOPE Subsite support patch.
http://www.mtg.co.at/projects/subhosting/

This patch allows ZPublisher to support subsites, which are additional
DNS names for some folder of an existing ZOPE site. For installation
instructions, see the file INSTALL.

As the CGI environment doesn't contain enough information for this to
do reliably (without relying on heuristics), it extends the expected
environment of ZPublisher by an new optional variable:
ZOPE_DROP_FOLDER. This variable contains the number of Folder objects
that are above the site start in the ZOPE database. The number can
have a "c" appended, in which case ZPublisher cuts off the Folders
above the site start Folder completely. This includes also
acquisition. 

WARNING: Do not use the "c" option if you do not exactly
know what you are doing. Standard ZOPE Folder objects are able to
fulfill the role the Toplevel Application object.

Example:

http://www.main.crt/            <-- main site.
http://www.main.crt/sites/sub/  <-- content of subsite
http://www.sub.crt/             <-- sub site. 

So basically www.main.crt is the whole ZOPE process, while www.sub.crt
should be mapped to a subfolder in www.main.crt, in a way that is
transparent to user.

For this to work, one just has to make www.sub.crt point to
zope.cgi/sites/sub/... and add ZOPE_DROP_FOLDER=2 to the CGI
environment.

Apache Example:

<VirtualHost ...>
...
Servername www.sub.crt
...
RewriteRule /(.*)	.../zope.cgi/sites/sub/$1 [e=HTTP_CGI_AUTHORIZATION:%1,E=ZOPE_DROP_FOLDER:2,t=application/x-httpd-cgi,l]
</VirtualHost>

Andreas Kostyrka
-- 
Win95: n., A huge annoying boot virus that causes random spontaneous system
     crashes, usually just before saving a massive project.  Easily cured by
     UNIX.  See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.