You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Alex \"Sniper\" Togstad" <sn...@3dretreat.com> on 2002/02/01 00:30:03 UTC

Runing Virtual Hosting behind a router.

Hello!

I have 2 domains and I need them to be forwared to my IP. (12.224.237.169)

I have set up a DNS server on my box:

ns1.domain1.com - 12.224.237.169
ns2.domain.com - 12.224.237.168 - dumy IP

I have Simple DNS insalled on my comp, and I'm pretty sure I set it up correctly!

I would like to keep the domains kept private till a known launch date if you don't mind, thus the reason for domain1.com and domain2.com

DocumentRoot C:/www/htdocs/ 

In "DocumentRoot" I have my personal webpage, and then I have other folders for the domains: 
domain1.com 
domain2.com 

domain1 root: 
C:/www/htdocs/domain1.com 

domain2 root: 
C:/www/htdocs/domain2.com 

I'm on a linksys router, and I have port 80, 53, and 21 forwarded to my box. My internal IP is 192.168.1.2, and my "IP" is 12.224.237.169.

I figured out everytime I put the internal IP for the primary vhost like this: "<VirtualHost 192.168.1.2 12.224.237.169>" then it would not show the index file for domain1.com, but show the index file for "http://12.224.237.169". 

But when I took out the internal IP for the primary vhost then I could see the domain1.com contents by going to www.domain1.com and "http://12.224.237.169". NOTE: I should not see the contents of domain1.com thru "http://12.224.237.169". 

When I go to www.domain1.com I should see a different html file thant that one for my IP. As you can see the domain1.com root is different that the other one, but still I see the the contents of the 12.224.237.169 webpage when I'm at the domain1.com url. 

At this point I'm stuck. I don't know how I should have Virtual Hosting setup. I know something is wrong, but I can't quiet get my finger on it!


Thank you very much for your time and help!

My httpd.conf file below:

==============================================
NameVirtualHost 12.224.237.169:80
#
#Virtual Host info for The Outpost
#
<VirtualHost 192.168.1.2 12.224.237.169>
    # primary vhost
    ServerName http://12.224.237.169
    ServerAdmin alextogstad@3dretreat.com
    DocumentRoot c:/www/htdocs/
</VirtualHost>
#
#Virtual Host info for domain1
#
NameVirtualHost 12.224.237.169
<VirtualHost 192.168.1.2 12.224.237.169>
    ServerName www.domain1.com
    ServerAdmin alextogstad@3dretreat.com
    DocumentRoot c:/www/domain1.com
</VirtualHost>
============================================



RE: Runing Virtual Hosting behind a router.

Posted by Joshua Slive <jo...@slive.ca>.
-----Original Message-----
From: Alex "Sniper" Togstad [mailto:sniper@3dretreat.com]

> When I go to www.domain1.com I should see a different html file thant that
one for my IP. As you
> can see the domain1.com root is different that the other one, but still I
see the the contents of
> the 12.224.237.169 webpage when I'm at the domain1.com url.

[Please post in plain text.]

A couple issues here.  I'm not sure that you have read the correct
documentation:
http://httpd.apache.org/docs/vhosts/name-based.html

- ServerName should not have "http://" in it.

- Use ServerAlias to have one vhost responde for more than one name (ie
domain1.com and www.domain1.com).

- If you are using a recent version of apache, you will probably have more
success if you use the "NameVirtualHost *" and "<VirtualHost *>"
configuration to catch all IP addresses.  It eliminates much potential
confusion.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org