Commit d1596f3e authored by Evan Simpson's avatar Evan Simpson

Check in the other bits of the modified VHM interface :-(

parent f58021f4
<dtml-var manage_page_header> <dtml-var manage_page_header>
<dtml-var manage_tabs> <dtml-var manage_tabs>
<h3>The Virtual Host Monster supports virtual hosting</h3>
<p class="form-help"> <p class="form-help">
This Virtual Host Monster changes the URLs generated inside of the It changes the protocol, host, and/or path of URLs generated by Zope.
Folder in which it is placed, using information passed to it in special URL Values affected include REQUEST variables starting with URL or BASE
path elements. Its purpose is to support virtual hosting, by (such as URL1, BASE2, URLPATH0), and the absolute_url() methods of
allowing you to centrally control the protocol, host, and path of the objects. By changing these, the Virtual Host Monster allows you to
URLs that Zope generates. host several different domains in a single Zope.
</p>
<p class="form-help">
The most common sort of virtual hosting setup is one in which you
create a Folder in your Zope root for each domain that you want to
serve. For instance <strong>http://www.buystuff.com</strong> is
served from Folder /buystuff.com while
<strong>http://www.mycause.org</strong> is served from /mycause.org.
</p>
<h3>One is enough</h3>
<p class="form-help">
A single Virtual Host Monster in your Zope root can handle all of your
virtual hosting needs. It doesn't matter what Id you give it, as long
as nothing else in your site has the same Id.
</p> </p>
<h3>You must add special names in the path</h3>
<p class="form-help"> <p class="form-help">
This object doesn't do anything unless you insert one The VHM doesn't do anything unless it sees one
or both of the following special path elements into a URL: of the following special path elements in a URL:
<em>VirtualHostBase</em> sets the protocol and host, while <em>VirtualHostBase</em> sets the protocol and host, while
<em>VirtualHostRoot</em> sets the path root. You would insert <em>VirtualHostRoot</em> sets the path root.</p>
these path elements using an Apache RewriteRule or ProxyPass
directive, or with a Zope Access Rule.
</p>
<p class="form-help"> <p class="form-help">
If the URL path of a request begins with If the URL path of a request begins with
&quot;/VirtualHostBase/http/www.foo.com&quot;, for instance, then &quot;/VirtualHostBase/http/www.buystuff.com&quot;, for instance, then
URLs generated by Zope will start with URLs generated by Zope will start with
<strong>http://www.foo.com</strong>. <strong>http://www.buystuff.com</strong>.
Since the port number was not specified, it is left unchanged. If Since the port number was not specified, it is left unchanged. If
your Zope is running on port 8080, and you want generated URLs not to your Zope is running on port 8080, and you want generated URLs not to
include this port number, you must use include this port number, you must use
&quot;/VirtualHostBase/http/www.foo.com:80&quot;. &quot;/VirtualHostBase/http/www.buystuff.com:80&quot;.
</p> </p>
<p class="form-help"> <p class="form-help">
...@@ -37,28 +50,66 @@ will traverse &quot;a/b/c/d&quot; and then generate a URL with ...@@ -37,28 +50,66 @@ will traverse &quot;a/b/c/d&quot; and then generate a URL with
path <strong>/d</strong>. path <strong>/d</strong>.
</p> </p>
<h3>You add these names by rewriting incoming URLs</h3>
<p class="form-help"> <p class="form-help">
If <em>VirtualHostRoot</em> is followed by one or more path elements Visitors to your site don't see these special names, of course.
that start with '_vh_', then these elements (without the '_vh_') will You insert them into the path using either an external rewriter,
be skipped and then added to the start of generated URLs. such as an Apache RewriteRule or ProxyPass directive, or by
For instance, a request with path &quot;/a/VirtualHostRoot/_vh_z/b&quot; setting up a mapping on the &quot;Mappings&quot; tab.
will traverse &quot;a/b&quot; and then generate a URL with </p>
path <strong>/z/b</strong>.
<p class="form-help">
For example, suppose Zope is running on port
8080 behind an Apache running on port 80. You place a Virtual Host
Monster in the Zope root Folder, and use Apache to rewrite &quot;/(.*)&quot;
to <strong>http://localhost:8080/VirtualHostBase/http/www.buystuff.com:80/buystuff.com/VirtualHostRoot/$1</strong>.
</p> </p>
<p class="form-help"> <p class="form-help">
Combining both allows you to cause a subfolder to act as the root of a You could get the same effect in a standalone Zope by adding the line
site. For example, suppose you want to publish Folder &quot;/foo&quot; as <code>www.buystuff.com/buystuff.com</code> to the &quot;Mappings&quot;
<strong>http://www.foo.com/</strong>, where Zope is running on port tab. In either case, requests for
8080 behind Apache running on port 80. You place a Virtual Host <strong>http://www.buystuff.com/anything</strong>
Monster in the root Zope folder, and use Apache to rewrite &quot;/(.*)&quot; will look for Zope object <strong>/buystuff.com/anything</strong>.
to <strong>http://localhost:8080/VirtualHostBase/http/www.foo.com:80/foo/VirtualHostRoot/$1</strong>
</p> </p>
<p class="form-help"> <p class="form-help">
Values affected include DTML variables starting with URL or BASE You should only use the &quot;Mappings&quot; tab for simple virtual
(such as URL1, BASE2, URLPATH0), and hosting, in a Zope that is serving requests directly. Each mapping
the absolute_url() methods of objects. line is a host name followed by a path to a Folder. The VHM checks
</p> the host specified in each incoming request to see if it is in the
list. If it is, then the corresponding path is inserted at the start
of the path, followed by &quot;VirtualHostRoot&quot;.
</p>
<p class="form-help">
You can match
multiple subdomains by putting &quot;*.&quot; in front of the host
name, as in &quot;*.buystuff.com&quot;. If an exact match exists, it
is used instead of a wildcard match.
</p>
<h3>Inside-out hosting</h3>
<p class="form-help">
Another use for virtual hosting is to make Zope appear to be part of a
site controlled by another server. For example, Zope might only serve
the contents of <strong>http://www.mycause.org/dynamic_stuff</strong>.
To accomplish this, you want to add &quot;dynamic_stuff&quot; to the
start of all Zope-generated URLs.
</p>
<p class="form-help">
If you insert <em>VirtualHostRoot</em>, followed by one or more path elements
that start with '_vh_', then these elements will
be ignored during traversal and then added (without the '_vh_') to the
start of generated URLs.
For instance, a request for &quot;/a/VirtualHostRoot/_vh_z/&quot;
will traverse &quot;a&quot; and then generate URLs that start with
<strong>/z</strong>.
</p>
<p class="form-help">
In our example, you would have the main server send requests for
<strong>http://www.mycause.org/dynamic_stuff/anything</strong>
to Zope, rewritten as
<strong>/VirtualHostRoot/_vh_dynamic_stuff/anything</strong>.
</p>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
You may edit the mappings for this Virtual Host Monster using the form below.
<strong><em>You don't need to use this tab</em></strong> if you are using
Apache or some other front-end server to rewrite requests. This is
only for simple virtual hosting in a bare Zope server. If you place
the hostname that you use to manage your Zope in this list
<strong><em>you are likely to regret it</em></strong>, and will
probably need to manage Zope using its raw IP address to fix things.
</p>
<form action="set_map" method="post">
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<dtml-with keyword_args mapping>
<tr>
<td align="left" valign="top" class="form-label">Last Modified</td>
<td align="left" valign="top" class="form-text">
<dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="2" class="form-help">
Each line represents a path mapping for a single host
(<strong>host/path</strong>),
or a set of hosts (<strong>*.host/path</strong>).
<div style="width: 100%;">
<textarea name="map_text:text" wrap="off" style="width: 100%;"<dtml-if
dtpref_cols> cols="<dtml-var dtpref_cols>"<dtml-else
> cols="50"</dtml-if><dtml-if dtpref_rows> rows="<dtml-var
dtpref_rows>"<dtml-else> rows="20"</dtml-if>><dtml-in
lines>&dtml-sequence-item;
</dtml-in></textarea>
</div>
</td>
</tr>
</dtml-with>
<tr>
<td align="left" valign="top" colspan="2">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked by WebDAV</em>
<dtml-else>
<input class="form-element" type="submit" name="SUBMIT" value="Save Changes">
</dtml-if>
&nbsp;&nbsp;
<input class="form-element" type="submit" name="SUBMIT" value="Taller">
<input class="form-element" type="submit" name="SUBMIT" value="Shorter">
<input class="form-element" type="submit" name="SUBMIT" value="Wider">
<input class="form-element" type="submit" name="SUBMIT" value="Narrower">
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment