ed wrote:
On Mon, 07 Apr 2008 10:12:18 +0200
Robert Schulze <[EMAIL PROTECTED]> wrote:
Are you doing this to save memory?
This is one important fact - it saves a huge amount of memory with
several thousands of virtualhosts.
One more interesting thing is, that apache does not need to be
restarted when adding domains :-)
Apache doesn't have to be restarted when adding virtual domains, you
can add the domains to the conf and send a USR1 to httpd and it will
reload that without interrupting existing requests AFAIK.
I've watched this thread with some interest, and some chuckling. There
are two distinct perspectives here, and I just thought I'd tackle both
perspectives.
2 - some of us think that whatever Apache needs will be configured
somewhere when apache loads, or we will create new virtual hosts on the
fly. This is an EXCELLENT suggestion when it comes to minor changes
over a longer period of time.
1 - the original poster is probably doing what I have done, which is
called a mass virtual host - there is no server record for each host, as
there could be (literally) thousands of virtual hosts, many being
created every minute, and also deleted. These kinds of environments are
typically found in web hosting companies or ISP's - a service geared to
handle harsh dynamics. Often, there is no other way to implement a
hosting service in this situation than this form.
In Apache 2.0, there was a mass_virtual_host module. In Apache 2.2,
there is actually a mod_vhost_alias module - these modules simply
overwrite some settings without creating new server_rec structures, such
as setting the r->hostname (hostname on a per-request basis, using
r->pool), a simple mapping method to a directory for the "document
root", and some other pieces to ensure environment variables and tables
are set for things like PHP and CGI. They run quickly, and are designed
for high volumes and high numbers of sites.
For the original poster, I suggest reviewing mod_vhost_alias.c in the
apache source code modules/mappers/ directory - it should give you a
great concept of what must be done to mimmick a configured server_rec
without actually creating one.
Joe
--
Joseph Lewis <http://sharktooth.org/>
"Divide the fire, and you will sooner put it out." - Publius Syrus