Setting up IP-based and Name-based virtual hosting side by side...

Setting up IP-based and Name-based virtual hosting side by side...

Post by alle » Sat, 01 Feb 2003 07:04:32



I've dug thru a bunch of similar questions, but nothing previously
advised seems to be helping. I've managed to confirm that IP and Name
based virtual hosting can coexist together on the same server, and
that using IP's are better than domain names to avoid dns lookups,
however, I can't seem to get this to work properly.

Originally, I had about a dozen domains all set up via name based
hosting, and they all work fine. Recently, I needed to add SSL to one
of the domains and later learned you need to have a unique IP to
accomplish this. However, I cant seem to get it to work, and there
doesn't seem to be much info available on this. I updated the DNS
record to point the domain to the new IP, as well as added the NAT to
my router, however, whenever I go to the domain it simply takes me to
the default web directory of the very first virtual host in the list.
When I switched it to the top of the list, it appeared to work, but
then I realized that the original public IP all the name based vh were
using would also default to the same directory.

Any help would be very greatly appreciated.

Here's (most) my setup: (the domain I'm trying to change to IP based
and later add SSL to is the last on the list - www.fourthehardway.com)

------------------->

NameVirtualHost 192.168.1.6

<VirtualHost 192.168.1.6>
DocumentRoot /var/www/html/clubflyers/home
ServerName www.clubflyers.com

ServerAlias clubflyers.com
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
CustomLog /home/www1/clubflyers.com/logs/access_log "combined"
Options ExecCGI FollowSymLinks Includes Indexes
</VirtualHost>

<VirtualHost 192.168.1.6>  
DocumentRoot /home/www1/gtcmedia.com/htdocs
ServerName www.gtcmedia.com

ServerAlias gtcmedia.com  
ScriptAlias /cgi-bin/ /home/www1/gtcmedia.com/cgi-bin/
CustomLog /home/www1/gtcmedia.com/logs/access_log "combined"
Options ExecCGI FollowSymLinks Includes Indexes
</VirtualHost>

<VirtualHost 192.168.1.6>
DocumentRoot /home/www1/fever3k.com/htdocs
ServerName www.fever3k.com

ServerAlias fever3k.com
ScriptAlias /cgi-bin/ /home/www1/fever3k.com/cgi-bin/
CustomLog /home/www1/fever3k.com/logs/access_log "combined"
Options ExecCGI FollowSymLinks Includes Indexes
</VirtualHost>

<VirtualHost 192.168.1.6>
DocumentRoot /home/www1/struggleinc.com/htdocs
ServerName www.struggleinc.com

ServerAlias struggleinc.com
ScriptAlias /cgi-bin/ /home/www1/struggleinc.com/cgi-bin/
CustomLog /home/www1/struggleinc.com/logs/access_log "combined"
Options ExecCGI FollowSymLinks Includes Indexes
</VirtualHost>

<VirtualHost 216.199.96.83>
DocumentRoot /home/www1/fourthehardway.com/htdocs
ServerName www.fourthehardway.com

ServerAlias fourthehardway.com
ScriptAlias /cgi-bin/ /home/www1/fourthehardway.com/cgi-bin/
CustomLog /home/www1/fourthehardway.com/logs/access_log "combined"
Options ExecCGI FollowSymLinks Includes Indexes
</VirtualHost>

 
 
 

Setting up IP-based and Name-based virtual hosting side by side...

Post by alle » Sun, 02 Feb 2003 00:55:52


After further investigating, I've learned that you need to have
multiple NIC's or IP aliasing for IP based virtual hosting. I'm
assuming this is why nothing is working. So, I'm now guessing that I
map a new internal IP to the same NIC
(http://www.pcquest.com/content/server_side/202041301.asp) and then do
the NAT to direct traffic from the new public IP to the newly created
internal IP in my router? I'm further guessing that I would then
create a new directive using the new internal IP in vh section of
httpd.conf and add the new virtual host block below it with the same
new internal IP?

Is my logic correct? I'd hate to go screwing things up on a hunch.
Please advise...


> I've dug thru a bunch of similar questions, but nothing previously
> advised seems to be helping. I've managed to confirm that IP and Name
> based virtual hosting can coexist together on the same server, and
> that using IP's are better than domain names to avoid dns lookups,
> however, I can't seem to get this to work properly.

> Originally, I had about a dozen domains all set up via name based
> hosting, and they all work fine. Recently, I needed to add SSL to one
> of the domains and later learned you need to have a unique IP to
> accomplish this. However, I cant seem to get it to work, and there
> doesn't seem to be much info available on this. I updated the DNS
> record to point the domain to the new IP, as well as added the NAT to
> my router, however, whenever I go to the domain it simply takes me to
> the default web directory of the very first virtual host in the list.
> When I switched it to the top of the list, it appeared to work, but
> then I realized that the original public IP all the name based vh were
> using would also default to the same directory.

> Any help would be very greatly appreciated.

> Here's (most) my setup: (the domain I'm trying to change to IP based
> and later add SSL to is the last on the list - www.fourthehardway.com)

> ------------------->

> NameVirtualHost 192.168.1.6

> <VirtualHost 192.168.1.6>
> DocumentRoot /var/www/html/clubflyers/home
> ServerName www.clubflyers.com

> ServerAlias clubflyers.com
> ScriptAlias /cgi-bin/ /var/www/cgi-bin/
> CustomLog /home/www1/clubflyers.com/logs/access_log "combined"
> Options ExecCGI FollowSymLinks Includes Indexes
> </VirtualHost>

> <VirtualHost 192.168.1.6>  
> DocumentRoot /home/www1/gtcmedia.com/htdocs
> ServerName www.gtcmedia.com

> ServerAlias gtcmedia.com  
> ScriptAlias /cgi-bin/ /home/www1/gtcmedia.com/cgi-bin/
> CustomLog /home/www1/gtcmedia.com/logs/access_log "combined"
> Options ExecCGI FollowSymLinks Includes Indexes
> </VirtualHost>

> <VirtualHost 192.168.1.6>
> DocumentRoot /home/www1/fever3k.com/htdocs
> ServerName www.fever3k.com

> ServerAlias fever3k.com
> ScriptAlias /cgi-bin/ /home/www1/fever3k.com/cgi-bin/
> CustomLog /home/www1/fever3k.com/logs/access_log "combined"
> Options ExecCGI FollowSymLinks Includes Indexes
> </VirtualHost>

> <VirtualHost 192.168.1.6>
> DocumentRoot /home/www1/struggleinc.com/htdocs
> ServerName www.struggleinc.com

> ServerAlias struggleinc.com
> ScriptAlias /cgi-bin/ /home/www1/struggleinc.com/cgi-bin/
> CustomLog /home/www1/struggleinc.com/logs/access_log "combined"
> Options ExecCGI FollowSymLinks Includes Indexes
> </VirtualHost>

> <VirtualHost 216.199.96.83>
> DocumentRoot /home/www1/fourthehardway.com/htdocs
> ServerName www.fourthehardway.com

> ServerAlias fourthehardway.com
> ScriptAlias /cgi-bin/ /home/www1/fourthehardway.com/cgi-bin/
> CustomLog /home/www1/fourthehardway.com/logs/access_log "combined"
> Options ExecCGI FollowSymLinks Includes Indexes
> </VirtualHost>


 
 
 

Setting up IP-based and Name-based virtual hosting side by side...

Post by Joshua Sli » Sun, 02 Feb 2003 01:22:46



> I updated the DNS
> record to point the domain to the new IP, as well as added the NAT to
> my router, however, whenever I go to the domain it simply takes me to
> the default web directory of the very first virtual host in the list.

This is probably a misconfiguration of your NAT or a misunderstanding
of how IP based vhosting works with NAT.

Your router must not only accept the second IP address, but it must
pass it ON A DIFFERENT IP ADDRESS through to the internal server.

Joshua.

 
 
 

Setting up IP-based and Name-based virtual hosting side by side...

Post by David Efflan » Sun, 02 Feb 2003 02:07:56



Quote:> After further investigating, I've learned that you need to have
> multiple NIC's or IP aliasing for IP based virtual hosting. I'm
> assuming this is why nothing is working. So, I'm now guessing that I
> map a new internal IP to the same NIC
> (http://www.pcquest.com/content/server_side/202041301.asp) and then do
> the NAT to direct traffic from the new public IP to the newly created
> internal IP in my router? I'm further guessing that I would then
> create a new directive using the new internal IP in vh section of
> httpd.conf and add the new virtual host block below it with the same
> new internal IP?

Don't you also need to specify port 443 for ssl (https)?

<VirtualHost 192.168.6.x:443>

--
David Efflandt - All spam ignored  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/