[lug] all CNAME'd domain dns troubles

Mike Loseke mike at verinet.com
Wed Jan 19 23:29:32 MST 2000


Thus spake Michael J. Pedersen:
> 
> 
> --Kj7319i9nmIyA2yE
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: quoted-printable
> 
> On Wed, Jan 19, 2000 at 04:05:14PM -0700, Andrew Diederich wrote:
> > I've looked about in DNS and Bind 2nd edition a bit, but haven't found wh=
> at
> > I need.  My company owns several domain names, but I want them all to poi=
> nt
> > to the same servers.  Example: if you go to www.netdelivery.com and
> > www.movia.com they should go to the same server.  I'm using Bind 4.9 on a
> > SuSE 6.3 box. =20
> 
> Well, having read the information you posted, and another individual's repl=
> y,
> you're all pretty well on the money.  Separate zone files for each domain w=
> ill
> correct 90% of your problems.

 Apache does the other 10%. See below.


> However, if you have a need to have the program on the same server
> differentiate between what is being asked for, you've got a whole separate =
> can
> of worms to deal with.
> 
> For instance, consider www.netdelivery.com and www.movia.com.  If they both
> point to the same IP address, and apache tries to figure out what to do with
> this, then both of them have to have the same web pages.  In other words, t=
> he
> only difference the user of the web pages can see is that one of them has a
> URL of http://www.netdelivery.com, and the other has a URL of
> http://www.movia.com.  The pages will be identical.
> 
> This is not due to a failing of the apache, but rather the way the internet
> itself works.  When you make a request of your web browser to open up
> www.netdelivery.com, it actually performs these steps:
> 

[discussion on seperate IP's snipped for some semblance of brevity]

 Nope, hang on. Apache can cope with multiple domains hitting the
exact same IP quite well. At least for a relatively small number of
domains. I'm running 5 of them off of one machine using only one IP
and no interface tricks. Check out the NameVirtualHost and VirtualHost
options in httpd.conf (versions 1.3.1 and newer I believe). Here's an
example snippet:

-----------------------------------------------------
   NameVirtualHost 10.1.1.1
   
   <VirtualHost 10.1.1.1>
       ServerAdmin webmaster at foo.com
       DocumentRoot /home/mike/www/foo.com
       ServerName foo.com
       <Directory />
         Options Includes ExecCGI FollowSymLinks
       </Directory>
       ErrorLog logs/foo.com-error_log
       CustomLog logs/foo.com-access_log common
   </VirtualHost>
   
   <VirtualHost 10.1.1.1>
       ServerAdmin webmaster at bar.com
       DocumentRoot /home/mike/www/bar.com
       ServerName www.bar.com
       <Directory />
         Options Includes ExecCGI FollowSymLinks
       </Directory>
       ErrorLog logs/bar.com-error_log
       CustomLog logs/bar.com-access_log common
   </VirtualHost>
-----------------------------------------------------

 If you have A records for www.foo.com and www.bar.com both pointing at
10.1.1.1 then this will have apache return different data based on how it
was contacted. Cool, huh?

-- 
   Mike Loseke    | One of life's best joys is putting the little 
 mike at verinet.com | rubber feet on a new piece of networking gear.




More information about the LUG mailing list