Re: [Zope] Apache/Zope mass name based virtual hosting
At 08:30 08/11/2001 -0600, Mark Langkau wrote:
Hi,
Can someone help with an Apache rewrite rule for using VirtualHostMonster for mass virtual name based hosting? My corporate intranet needs to have several development and testing areas. What I'd like to do is have virtual hosts set up for each developer to experiment with - on the fly.
The goal is not to change httpd.conf or restart Apache when a new vhost is set up. Apache will not know specific host names in advance. This will allow our developers to quickly put together proof-of-concept sites and send easy to remember URLs to other internal testers without mucking around with Apache configs or restarts.
I have seen examples of using VHM to map domains to folders inside Zope, but I can't seem to understand how to send the correct info from Apache to Zope. I'd like to use wildcards in Apache so that as long as a folder exists in the right place (and with the right name) in Zope, the user will get to the right area.
Example:
Assume our domain is example.com. Internal DNS will be set to send *.test.example.com to 192.168.1.1 so all hosts matching that pattern go to real host "test.example.com." I would like "mark.test.example.com" to map to "/site/mark" and "beta.test.example.com" map to "/site/beta" inside Zope.
I'll post a "How-To" when I get this working if one doesn't exist already.
Thanks! Mark
Sorry for sending again but the closing paren ')' was misplaced in the RewriteCond in the first sending of this suggestion. I think adding a numbered virtual host directive containing a rewrite condition and rewrite rule will work. Taking your example and assuming your Zope is running on port 8080 of a machine name zope.example.com, try: <VirtualHost 192.168.1.1> RewriteCond %{SERVER_NAME} ^([^\.]+)\.test\.example\.com$ RewriteRule (.*) http://zope.example.com:8080/VirtualHostBase/http/%1.test.example.com:80/sit... [P] </VirtualHost> The rewrite condition regex lets you capture the pseudo machine name, e.g. mark from mark.test.example.com in your example. The rewrite rule condition embeds the pseudo machine name in both the virtual host base the VHM uses to generate URLs and prefixes it in the path below the virtual host root and above your site directory. This rewrite should work with any pseudo machine name without the need to modify httpd.conf or restart Apache when a new pseudo machine is "created". Any incoming request for a machine which doesn't have a folder in Zope's /site folder should lead to a 404 - Not Found response from Apache.
participants (1)
-
Richard Barrett