Apache/Zope mass name based virtual hosting
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
I think you need something like mod_vhost_alias (Apache builtin) or mod_macro (3rd party module). On Thu, Nov 08, 2001 at 08:30:24AM -0600, Mark Langkau wrote:
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.
Oleg. -- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
You might be able to use "dynamic" Rewrite as described here: http://zope.nipltd.com/public/lists/zope- archive.nsf/ByKey/EB1D1CF1157DF1B2 and here: http://httpd.apache.org/docs/misc/rewriteguide.html Note that my example is for load balancing, but could easily be adapted for your purpose. Good Luck! -steve On Thursday, November 8, 2001, at 09:30 AM, 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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Mark Langkau wrote:
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.
There may well be other ways to do this, but this is the one that first occurred to me: <VirtualHost xx.xx.xx.xxx> ServerName test.example.com ServerAlias *.test.example.com RewriteEngine On RewriteCond %{HTTP_HOST} ^([^.]+)\.test\.example\.com$ RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/site/%1/VirtualHostRoot/$1 [P,L] </VirtualHost> This is untested, but should be roughly correct. The last rewrite rule is meant to be a single line of text, not three. You must have a VHM installed in the Zope root. Cheers, Evan @ Zope
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
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 (5)
-
Evan Simpson -
Mark Langkau -
Oleg Broytmann -
Richard Barrett -
Steve Spicklemire