Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

migrate IP based to name based virtual hosting

Status
Not open for further replies.

alunward

IS-IT--Management
Jan 15, 2003
6
GB
Hi,
I'm about to migrate from IP based to name based virtual hosting - oh, hey, that's in the header already ;-)
This is for ease of maintenance and releasing some IP addresses.

does anyone have any special tips I should follow to avoid DNS caching troubles?
Looking at the advice on the Apache web site, where they have an example going the reverse way, I should be able to add the main IP address I'll be using for all the name based hosts, to the old different IP address currently used for the vhosts.

This will cover the situation until I'm sure DNS has updated across the web. Is this right?

ie previously (not real IP addresses!)
For example, main server running on 192.168.0.1
<VirtualHost 192.168.0.2>
etc
</VirtualHost>

becomes

<VirtualHost 192.168.0.2 192.168.0.1>
etc
</VirtualHost>

Am I missing something obvious?

Thanks,

Alun

 
To switch to name based addressing, you will need to use this directive:

NameVirtualHost *

Then get rid of the ip address in container definition:

<VirtualHost *>

Now apache will resolve each web address by looking for the ServerName directive in each container.

ServerName
You should not have to change anything else since apache will listen for all http traffic on port 80. There should be no dns issues however, look for this directive and change it to:

UseCanonicalName Off

Some distros seem to need this in each container.
 
Thanks RhythmAce - sounds less confusing than doubling up on IP addresses.
As you say, it'll listen to all http traffic, and therefore cope with any traffic for the old IP addresses for as long as my server has those interfaces up.
Presumably I still need to add my main server config in the first Virtual host container?

Thanks again,

Alun
 
Just for info - if anyone else tries this - went down my initial route, including both IP addresses in the VirtualHost containers, and all worked fine this morning. I will change it to using starred convention later to test that method too.

Thanks,

Alun

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top