You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/02/26 19:10:24 UTC

Re: Virtual Hosting w/ mod_rewrite \(complete solution\?\)

In article <34...@posthuman.com> you wrote:

>> In the past we have tried to support mass virtual hosting without
>> <VirtualHost> sections by using mod_rewrite. We have discovered that we need
>> UseCanonicalName, etc. Now that we have the functionality we should thing
>> again about this interesting point and try to discover a complete solution we
>> can present to the users.
>> 
>> So, I've started from scratch and my current solution looks like the
>> following. I've still not tested it, but it should be 95% correct. Please fix
>> me were I'm wrong or where we need to configure more. Please give feedback.

> We have had this going for over a month now here at Hypermart...
> We would be very interested in having the ability added into
> the normal Apache dist instead of us having to re-port our
> patches to each new version.

What are your current set of patches? I thought your patches were superseeded
by the patch which introduced the UseCanonicalName.  Is this not the case?

>> -----------------------------------
>> ##
>> ##  vhost.map
>> ##
>> www.vhost1.dom:80  /path/to/docroot/vhost1
>> www.vhost2.dom:80  /path/to/docroot/vhost2
>>      :
>> www.vhostN.dom:80  /path/to/docroot/vhostN
>> -----------------------------------

> We have ours set up to deal with our subdomains instead of
> vhost.com type names (i.e. username.hypermart.net). This
> way we do not need a config file like this that may take
> up a lot of mem in each process (we have over 11k vhosts now
> on one box). It would also be nice to be able to use mod_rewrite
> for our regular vhost.com vhosts as well- perhaps you could
> develop a combo ruleset that would cover both types of vhosts-
> one using a map file and one without?

Yes, good idea. While you are correct that the above consumes memory because
the looked-up values are cached in-core, you can simply avoid this: Trivially
convert this map to DBM format and then you can put 11k names into it without
memory waste in the httpd processes while having fast access to it at the same
time. That's what the dbm:-type for RewriteMap is intended for.

>>[...]
>> #   use the canonical hostname on redirects, etc.
>> UseCanonicalName

> Is this part of 1.3? We are still running 1.2.4- does this
> accomplish the same thing as the hacks we made to our server
> to use the Host: header when available?

Yes, part of 1.3. I've not at hand your patches, but the UseCanonicalName _is_
the new feature which uses the Host:-header, yes.

>[...]
>> RewriteMap    vhost        txt:/path/to/vhost.map

> Is this map shared between all servers or will it bloat all
> of them?

No, this way it cached within each process. But simple
use

   RewriteMap    vhost        dbm:/path/to/vhost.map

and you can avoid this memory waste again.

>[...]
> Yes this is very similiar to what we are using, minus the
> map file... The ultimate test of these rules seems to be
> MS Frontpage. If these vhosts work with that then they should
> work with everything :-)

What do you mean with Frontpage? Frontpage in browser mode
or in publishing mode? Or do you mean Internet Explorer?

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Re: Virtual Hosting w/ mod_rewrite \(complete solution\?\)

Posted by Brian Atkins <br...@posthuman.com>.
Ralf S. Engelschall wrote:
> 
> In article <34...@posthuman.com> you wrote:
> 
> >> In the past we have tried to support mass virtual hosting without
> >> <VirtualHost> sections by using mod_rewrite. We have discovered that we need
> >> UseCanonicalName, etc. Now that we have the functionality we should thing
> >> again about this interesting point and try to discover a complete solution we
> >> can present to the users.
> >>
> >> So, I've started from scratch and my current solution looks like the
> >> following. I've still not tested it, but it should be 95% correct. Please fix
> >> me were I'm wrong or where we need to configure more. Please give feedback.
> 
> > We have had this going for over a month now here at Hypermart...
> > We would be very interested in having the ability added into
> > the normal Apache dist instead of us having to re-port our
> > patches to each new version.
> 
> What are your current set of patches? I thought your patches were superseeded
> by the patch which introduced the UseCanonicalName.  Is this not the case?

Yes I guess it is. The only other mods we've made are to have
CGI output parsed for SSIs, and we modified mod_include a bit
to add our advertising to pages served up.

> 
> >> -----------------------------------
> >> ##
> >> ##  vhost.map
> >> ##
> >> www.vhost1.dom:80  /path/to/docroot/vhost1
> >> www.vhost2.dom:80  /path/to/docroot/vhost2
> >>      :
> >> www.vhostN.dom:80  /path/to/docroot/vhostN
> >> -----------------------------------
> 
> > We have ours set up to deal with our subdomains instead of
> > vhost.com type names (i.e. username.hypermart.net). This
> > way we do not need a config file like this that may take
> > up a lot of mem in each process (we have over 11k vhosts now
> > on one box). It would also be nice to be able to use mod_rewrite
> > for our regular vhost.com vhosts as well- perhaps you could
> > develop a combo ruleset that would cover both types of vhosts-
> > one using a map file and one without?
> 
> Yes, good idea. While you are correct that the above consumes memory because
> the looked-up values are cached in-core, you can simply avoid this: Trivially
> convert this map to DBM format and then you can put 11k names into it without
> memory waste in the httpd processes while having fast access to it at the same
> time. That's what the dbm:-type for RewriteMap is intended for.

Yes.. but on the other hand, we've found that with a fast PII
and plenty of mem, that the limiting factor on our system has
been disk IO. The fewer accesses, the better.

> 
> >>[...]
> >> #   use the canonical hostname on redirects, etc.
> >> UseCanonicalName
> 
> > Is this part of 1.3? We are still running 1.2.4- does this
> > accomplish the same thing as the hacks we made to our server
> > to use the Host: header when available?
> 
> Yes, part of 1.3. I've not at hand your patches, but the UseCanonicalName _is_
> the new feature which uses the Host:-header, yes.
> 
> >[...]
> >> RewriteMap    vhost        txt:/path/to/vhost.map
> 
> > Is this map shared between all servers or will it bloat all
> > of them?
> 
> No, this way it cached within each process. But simple
> use
> 
>    RewriteMap    vhost        dbm:/path/to/vhost.map
> 
> and you can avoid this memory waste again.
> 
> >[...]
> > Yes this is very similiar to what we are using, minus the
> > map file... The ultimate test of these rules seems to be
> > MS Frontpage. If these vhosts work with that then they should
> > work with everything :-)
> 
> What do you mean with Frontpage? Frontpage in browser mode
> or in publishing mode? Or do you mean Internet Explorer?
> 
>                                        Ralf S. Engelschall
>                                        rse@engelschall.com
>                                        www.engelschall.com

I mean both I guess... I'll be convinced your ruleset and
server are completely working when I can open, edit, and
save files within a web on a vhost done in this manner.

As for creating a module for this stuff, that sounds ok. Just
make sure it has the ability to pass through requests that
don't have the Host: header to a main server that can handle
it.
-- 
The future has arrived; it's just not evenly distributed.
                                                       -William Gibson
______________________________________________________________________
Visit Hypermart at http://www.hypermart.net for free business hosting!