[Zope] VirtualHostMonster
Felix Ulrich-Oltean
felix@chaptereight.com
Wed, 2 Oct 2002 16:24:27 +0100
Dag
On Wed, Oct 02, 2002 at 05:50:25PM +0300, Dag Nygren wrote:
> BTW. Is there any good documentation on VHM ?
> It took me a long time to figure out that VirtualHostBase is a literal and
> shouldn't be replaced with anything as I tried to do.
> Have still not figured out what VirtualHostRoot does ;-(
I've found the following page the most useful in this respect:
http://www.zope.org/Members/regebro/Zope_and_Apache
> Scenario:
> - Apache as frontend with ProxyPass rules
> - ZServer should serve a certain address, say http://www.xx.com/zopeit
> from a certain sub"floder" in the Zope hierarchy.
Your case sounds just like ours, so here's how we do it:
Let's say:
- you want to serve http://www.xx.com/zopeit
- inside your zope this corresponds to localhost:8080/sites/xx.com
In the root of your zope you should have a VirtualHostMonster, named
anything you like.
In you httpd.conf, you should have:
## with all the other AddModule and LoadModule:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/libproxy.so
AddModule mod_rewrite.c
AddModule mod_proxy.c
## in your virtual hosts section:
<VirtualHost 66.66.66.66:80>
DocumentRoot /var/www/anything-goes
ServerName xx.com
ServerAlias www.xx.com
RewriteEngine on
RewriteRule ^/zopeit/(.*)$
http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/sites/xx.com/VirtualHostRoot/$1 [L,P]
</VirtualHost>
That's it!
- the VirtualHostBase means "please use VHM to re-write urls"
- the http means use the http protocol (as opposed to https)
- the %{HTTP_HOST} means use the host part of the request as the host
in the rewritten urls, i.e. www.xx.com or xx.com; you could replace
%{HTTP_HOST} with 'xx.com', but then www.xx.com would be re-written
to xx.com
- :80 means use port 80 in the re-written urls, i.e. don't show an
explicit port
- /sites/xx.com/VirtualHostRoot/ means the site is rooted in Zope at
/sites/xx.com
- $1 means pass on the path information to zope as it is,
e.g. "http://xx.com/zopeit/search?fish=cod" becomes
"http://localhost:8080/sites/xx.com/search?fish=cod"
Hope this helps,
Felix.
P.S. if this doesn't scratch your itch, ask the list again, perhaps
including the relevant bits of your conf files, and you'll get there.