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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple domains using one IP address 2

Status
Not open for further replies.

cglaeser

Programmer
Jul 19, 2002
7
US
Is it possible to support multiple websites with unique domains using one IP address? Perhaps I was misuing Apache, but I had this working with a DSL bridge router. We have recently upgraded to a DSL router that uses NAT (Network Address Translation), and the old solution no longer works. The previous httpd.conf file used:

NameVirtualHost 209.220.45.204

<VirtualHost DocumentRoot /u/apache/a
ServerName # more stuff
</VirtualHost>

<VirtualHost DocumentRoof /u/apache/b
ServerName # more stuff
</VirtualHost>

However, this no longer works, apparently because DNS lookup does not work after NAT translation. To avoid DNS lookup, I changed these entries to

<VirtualHost 10.10.10.2>
DocumentRoot /u/apache/a
ServerName # more stuff
</VirtualHost>

<VirtualHost 10.10.10.2>
DocumentRoof /u/apache/b
ServerName # more stuff
</VirtualHost>

The 10.10.10.2 is the internal, translated IP address. Visits to works, but visits to are mapped to Suggestions?

Any assistance will be greatly appreciated.

Best,
Christopher
 
I have reveiwed the suggestions in the FAQ as well as other threads, and I still can't get Virtual Hosting to work behind this new DSL router. I have defined two virtual hosts, and it always defaults to the first virtual host. Any ideas?

 
I see a directive &quot;NameVirtualHost 209.220.45.204&quot;. Shouldn't that read &quot;NameVirtualHost 10.10.10.2&quot;? ______________________________________________________________________
Never forget that we are
made of the stuff of stars
 
Thanks for responding. I've tried 10.10.10.2. I've tried *. I've tried setting VirtualHost to *. Nothing I have tried has worked.

I did a google search and found dozens of threads on the topic posted the last couple of years, but not one solution. Apparently, this is a very common problem. It's odd that I can't find a solution for such a common problem. I couldn't find anything at
Best,
Christopher
 
I finally got it to work. I changed the virtual host entries back to this:

<VirtualHost DocumentRoot /u/apache/a
ServerName # more stuff
</VirtualHost>

<VirtualHost DocumentRoof /u/apache/b
ServerName # more stuff
</VirtualHost>

and then I added the following entry to /etc/hosts:

10.10.10.2
The IP address 10.10.10.2 is the NAT internal address. The domains and are known to the world outside the NAT firewall by the external IP address.

FWIW, setting VirtualHost to 10.10.10.2 did not work, nor did setting it to *.

Hope that helps someone else.

Best,
Christopher
 
This has got to be the best information that I could find!!! I've been searching for this answer for awhile. I came across the same problems, finding people ask the questions, but no answers. I search everything that I could thing of ( Virtual host behind router, virtual host error, virtual host nat , just to give a few but no luck.) It's great to find people that not only ask the questions but follow up with the answer if they find it themselves!!! Great Job!!!
 
It should work with the *, if you follow the format below. I'm doing this with a nat router and without adding anything to /etc/hosts

NameVirtualHost *

<VirtualHost *:80>
DocumentRoot /u/apache/a
ServerName #more stuff
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /u/apache/b
ServerName #more stuff
</VirtualHost>
 
You ought to be able to have your system admin configure a DNS entry for both these items, allowing you to make this avilable to others inside your intranet. Your HOSTS entry should then be removed, as it would override the DNS information. cws.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top