What's the "best" way to set up a few virtual hosts using only ZServer? For example, to make www.mysite.com/vhosts/foo and www.mysite.com/vhosts/bar appear as www.foo.com and www.bar.com respectively. Do I need a SiteRite product or can this work with just a VirtualHostMonster? Walter
From: "Walter Miller" <wmiller@macromedia.com>
What's the "best" way to set up a few virtual hosts using only ZServer? For example, to make www.mysite.com/vhosts/foo and www.mysite.com/vhosts/bar appear as www.foo.com and www.bar.com respectively. Do I need a SiteRite product or can this work with just a VirtualHostMonster?
Neither SiteRoots nor VirtualHostMonsters can do the job by themselves. They both need somebody doing the first half of the virtual host mapping -- sending requests for www.foo.com to /vhosts/foo. Apache can do this, but if you want a bare ZServer, you'll need to use an Access Rule. Setting the following Script as root Access Rule should do it, in conjunction with a VHM: ## Script (Python) "vhost_access" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath= ##parameters=self, req, resp ##title=Virtual Host Access Rule ## host = req['HTTP_HOST'] stack = req['TraversalRequestNameStack'] # Put path elements on the stack in reverse order. if host == 'www.foo.com': stack.extend(['VirtualHostRoot', 'foo', 'vhosts']) elif host == 'www.bar.com': stack.extend(['VirtualHostRoot', 'bar', 'vhosts']) Cheers, Evan @ digicool & 4-am
Hello! On Tue, 6 Feb 2001, Evan Simpson wrote:
Neither SiteRoots nor VirtualHostMonsters can do the job by themselves. They both need somebody doing the first half of the virtual host mapping -- sending requests for www.foo.com to /vhosts/foo. Apache can do this, but
As far as I understand VirtualHostMonster, it can create a virtual host only for root on www.foo.com. That is I can redirect http://www.foo.com/ to /VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/. But what if I want to make www.foo.com static site under Apache but redirect a directory (location, actually) to Zope? For exampl, I want www.foo.com to be a static site, but serve www.foo.com/Zope from Zope. It seems VirtualHostMonster cannot do this, and I need to go back to SiteAccess. The problem is that currently VirtualHostMonster receives only 3 parameters - protocol (http), virtual server domain (www.foo.com) and Zope folder (/vhosts/foo). It need to receive yet another parameter - virtual host path (www.foo.com/Zope in my example). Any chance this will be implemented? Should I file a feature request into Collector? Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Oleg Broytmann
As far as I understand VirtualHostMonster, it can create a virtual host only for root on www.foo.com. That is I can redirect http://www.foo.com/ to /VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/. But what if I want to make www.foo.com static site under Apache but redirect a directory (location, actually) to Zope? For exampl, I want www.foo.com to be a static site, but serve www.foo.com/Zope from Zope. It seems VirtualHostMonster cannot do this, and I need to go back to SiteAccess.
You can do this by redirecting all requests under /Zope to /VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/Zope Under Apache with FastCGI, something like this: RewriteRule ^/Zope/(.*) /zope.fcgi/VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/Zope/ $1 [L] _______________________ Ron Bickers Logic Etc, Inc. rbickers@logicetc.com
On Wed, 7 Feb 2001, Ron Bickers wrote:
As far as I understand VirtualHostMonster, it can create a virtual host only for root on www.foo.com. That is I can redirect http://www.foo.com/ to /VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/. But what if I want to make www.foo.com static site under Apache but redirect a directory (location, actually) to Zope? For exampl, I want www.foo.com to be a static site, but serve www.foo.com/Zope from Zope. It seems VirtualHostMonster cannot do this, and I need to go back to SiteAccess.
You can do this by redirecting all requests under /Zope to /VirtualHostBase/http/www.foo.com/vhosts/foo/VirtualHostRoot/Zope
Interesting things to try. Do you beleive VirtualHostMonster will correctly strip /Zope from PATH_INFO and append it to paths (base, URLn and absolute_url)?
Under Apache with FastCGI, something like this:
I use mod_pcgi2, just the best modu... oops, sorry, shameless plug :) Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Oleg Broytmann Sent: Wednesday, February 07, 2001 10:02 AM To: Ron Bickers Cc: Zope Mailing List Subject: RE: [Zope] VirtualHostMonster w/ ZServer
Interesting things to try. Do you beleive VirtualHostMonster will correctly strip /Zope from PATH_INFO and append it to paths (base, URLn and absolute_url)?
PATH_INFO shows the /VirtualHost/... and all that mess. My understanding is that you should not use that in Zope anyway, but should use the BASE, URL, etc. vars. Given that... yes, BASEx and URLx correctly reflect the trailing /Zope in the URL in this case. _______________________ Ron Bickers Logic Etc, Inc. rbickers@logicetc.com
On Wed, 7 Feb 2001, Ron Bickers wrote:
Interesting things to try. Do you beleive VirtualHostMonster will correctly strip /Zope from PATH_INFO and append it to paths (base, URLn and absolute_url)?
PATH_INFO shows the /VirtualHost/... and all that mess. My understanding is that you should not use that in Zope anyway, but should use the BASE, URL, etc. vars.
Of course I do not use it. I meant only internal machinery.
Given that... yes, BASEx and URLx correctly reflect the trailing /Zope in the URL in this case.
Nice. Thank you very much. This is definitely a thing to try and, if proved true, I'd say VirtualHostMonster is excellent Zope Product! :) Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
From: "Oleg Broytmann" <phd@phd.pp.ru>
The problem is that currently VirtualHostMonster receives only 3 parameters - protocol (http), virtual server domain (www.foo.com) and Zope folder (/vhosts/foo). It need to receive yet another parameter - virtual host path (www.foo.com/Zope in my example). Any chance this will be implemented? Should I file a feature request into Collector?
I considered adding this, but it's more complicated to spell than the other two, and they take care of 95% (estimated) of the virtual hosting setups out there, so I left it out of the first cut. I'd be happy to add it to the next version. Can you suggest a spelling? Cheers, Evan @ digicool & 4-am
On Wed, 7 Feb 2001, Evan Simpson wrote:
The problem is that currently VirtualHostMonster receives only 3 parameters - protocol (http), virtual server domain (www.foo.com) and Zope folder (/vhosts/foo). It need to receive yet another parameter - virtual host path (www.foo.com/Zope in my example).
I considered adding this, but it's more complicated to spell than the other two, and they take care of 95% (estimated) of the virtual hosting setups out there, so I left it out of the first cut. I'd be happy to add it to the next version. Can you suggest a spelling?
I am not sure. It depends on how VHM is implemented. Does it use traversing machinery? Should I use only slashes or can use other separators? What about the following way: /VirtualHostBase/http:www.foo.com/Zope:/root/foo_folder/VirtualHostRoot/ Here go the protocol, hostname, virtual path and zope folder. Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
From: Oleg Broytmann <phd@phd.pp.ru>
I am not sure. It depends on how VHM is implemented. Does it use traversing machinery? Should I use only slashes or can use other separators?
It uses __before_traverse__ to check for "VirtualHostBase" and to replace "VirtualHostRoot" elements with its own Id. This causes it to be acquired, and __bobo_traverse__ performs the "VirtualHostRoot" processing.
What about the following way:
/VirtualHostBase/http:www.foo.com/Zope:/root/foo_folder/VirtualHostRoot/
Here go the protocol, hostname, virtual path and zope folder.
The virtual path, zope folder, and the remainder of the path need to be separated by delimiters, and the virtual path needs some kind of prefix, since it will often be omitted. In your example, the ':' is both separating the paths and indicating that there *is* a virtual path, which seems fragile to me. Perhaps the simplest (if a bit awkward) answer, would be something like: /VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/$ 1 In this example, "VirtualHostRoot" processing consumes any following path elements that start with "_vh_", strip off the prefix, and use the result as the virtual path. (The "$1" is where the remainder of the path is inserted by Apache). Cheers, Evan @ digicool & 4-am
Hi! On Fri, 9 Feb 2001, Evan Simpson wrote:
Perhaps the simplest (if a bit awkward) answer, would be something like:
/VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/$1
Looks reasonably good.
In this example, "VirtualHostRoot" processing consumes any following path elements that start with "_vh_", strip off the prefix, and use the result as the virtual path. (The "$1" is where the remainder of the path is inserted by Apache).
What about longer virtual path? /VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/_vh_foo/$1 or /VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/foo/$1 ? Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
From: Oleg Broytmann <phd@phd.pp.ru>
What about longer virtual path?
/VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/_ vh_foo/$1 Yes, this is what I've implemented. It also takes care of the problem where 'manage_main' directly after VirtualHostRoot gives you the VHM page, rather than the manage page of your virtual root. Cheers, Evan @ digicool & 4-am
On Mon, 12 Feb 2001, Evan Simpson wrote:
/VirtualHostBase/http/www.foo.com/root/foo_folder/VirtualHostRoot/_vh_Zope/_ vh_foo/$1
Yes, this is what I've implemented. It also takes care of the problem where
Ok, thank you.
'manage_main' directly after VirtualHostRoot gives you the VHM page, rather than the manage page of your virtual root.
Nice, nice, I want it! (Really, I encountered this problem just today) When it will be incorporated into official Zope? Any chance it'll go into 2.3.1? Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
From: Oleg Broytmann <phd@phd.pp.ru>
Nice, nice, I want it! (Really, I encountered this problem just today) When it will be incorporated into official Zope? Any chance it'll go into 2.3.1?
Yes, it's in the 2_3 CVS branch and the trunk, so it will be in 2.3.1. You can probably grab it from CVS directly, if you want it now; All the changes are in Products/SiteAccess. Cheers, Evan @ digicool & 4-am
On Mon, 12 Feb 2001, Evan Simpson wrote:
From: Oleg Broytmann <phd@phd.pp.ru>
Nice, nice, I want it! (Really, I encountered this problem just today) When it will be incorporated into official Zope? Any chance it'll go into 2.3.1?
Yes, it's in the 2_3 CVS branch and the trunk, so it will be in 2.3.1. You can probably grab it from CVS directly, if you want it now; All the changes are in Products/SiteAccess.
Thank you very much! Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (4)
-
Evan Simpson -
Oleg Broytmann -
Ron Bickers -
Walter Miller