[PLUG] apache virtual host setups
Michael Rasmussen
mikeraz at patch.com
Wed Apr 6 01:45:47 UTC 2005
Josh Orchard wrote:
> Rasmussen example:
> > <VirtualHost *>
> > ServerName www.patch.com
> > DocumentRoot /var/www/patch
> > </VirtualHost>
>
> Ok, just getting back to this. I guess what I didn't understand was
> how the IP worked in the Virtual Host. Now I did read the link but
> then I also read all these warnings from Apache here:
>
> http://httpd.apache.org/docs-2.0/dns-caveats.html
>
> Now these are dated 1997 and not updated for the 2.0 release. I can't
> tell if they are a big deal anymore. This was my concern.
The warnings do apply. Consider the differences between:
<VirtualHost www.patch.com>
<config statements>
</VirtualHost>
and
<VirtualHost *>
<config statements>
</VirtualHost>
and
<VirtualHost 199.88.144.12>
<config statements>
</VirtualHost>
In the first example Apache needs to do DNS resolution to find out
what the IP address of www.patch.com is, the second doesn't care
and will apply to all IP addresses configured on the computer,
the third will only apply to requests that arrive at 199.88.144.12.
The IP address, or equivalent, in the <VirtualHost ...> tag instructs
Apache about what IP address(es) it should apply the block of directives
to. Note that the tag can contain multiple addresses.
For example:
<VirtualHost 199.88.144.12, 10.1.1.12>
ServerAdmin webmaster at host.foo.com
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerAdmin developer at host.foo.com
DocumentRoot /www/docs/test.foo.com
ServerName host.foo.com
ErrorLog logs/test.foo.com-error_log
TransferLog logs/test.foo.com-access_log
</VirtualHost>
A developer can access host.foo.com from the local box and be directed
to a test tree of the site and it's content. Any other request for
host.foo.com - that will arrive on one of the two interfaces not local -
will be directed to the real site content.
Full explanation at:
http://httpd.apache.org/docs-2.0/mod/core.html#virtualhost
--
Michael Rasmussen, Portland Oregon
Be appropriate && Follow your curiosity
http://meme.patch.com/memes/BicycleRiding
Get Fixed: http://www.dampfixie.org
The fortune cookie says:
I have seen these EGG EXTENDERS in my Supermarket ... I have read the
INSTRUCTIONS ...
More information about the PLUG
mailing list