[TriLUG] Problems with webserver at home
Kevin Hunter
hunteke at earlham.edu
Wed Mar 12 10:07:41 EDT 2008
At 9:52a -0500 on Wed, 12 Mar 2008, Roy Vestal wrote:
> How would I go about adding the virtual hosts?
Like it looks like you've already done it. <VirtualHost> directives
to Apache.
> 10.0.0.1 firstsite.example.com # would be the first host I'm assuming
> 10.0.0.1 secondsite.example.com # wouldn't this bring up the first
> site?
No. This is just a pointer from your machine to 10.0.0.1 when you use
either of those names. In the HTTP headers that your browser sends,
there is a Host line
...
Host: secondsite.example.com
...
Apache will listen at 10.0.0.1 for requests, but use the Host line to
decide how to respond.
> <VirtualHost *:80>
> Servername firstsite.example.com:80
> DocumentRoot "/www/site1"
> </VirtualHost>
>
> <VirtualHost *:80>
> Servername secondsite.example.com:80
> DocumentRoot "/www/site2"
> </VirtualHost>
It's the ServerName directive that tells Apache from what DocumentRoot
to service the request.
You might spend a minute looking through the Apache docs on virtual
hosts. http://httpd.apache.org/docs/2.2/vhosts/examples.html
Kevin
More information about the TriLUG
mailing list