LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2009, 05:23 AM   #1
AndyBG
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
Combined IP/Name-based virtual host problem


Hi folks,

I have been trying to figure this out for a few days now and I've pulled out most of my hair. Can someone please put me out of my misery.

I need to transfer several domains from simple, managed web-hosting to a semi-dedicated VPS server so that I can get my hands dirty and get the extra control that I crave.

My server uses Debian flavoured Linux with Apache2 (I have no choice in this) and I have 3 IP addresses.

I want to implement a combined IP/Name-based virtual host configuration.

Directories sites-available and sites-enabled are both empty.

In the example (below), I have 4 sites.
Browsing to www.site-A.com and www.site-B.com works correctly.
Browsing to www.site-C.com and www.site-D.com always shows site-C.
If I change the order so that site-D appears before site-C, then browsing to either will show site-D.

I have looked everywhere for examples of combined IP/Name-based configs, but it never makes any difference.

I have set DNS so that the 4 sites point into my server:

site-A goes to 123.45.67.100
site-B goes to 123.45.67.101
site-C and site-D both go to 123.45.67.199

And here is my server configuration:

Code:
ServerName localhost
Listen 80


#####  site-A.com on 123.45.67.100

<VirtualHost 123.45.67.100>
	ServerName site-A.com
  DocumentRoot /var/www/sites/site-A/htdocs
</VirtualHost>


#####  site-B.com on 123.45.67.101

<VirtualHost 123.45.67.101>
	ServerName site-B.com
  DocumentRoot /var/www/sites/site-B/htdocs
</VirtualHost>



#####  Multiple name-based virtual hosts on 123.45.67.199  #####


NameVirtualHost 123.45.67.199


#####  site-C.com on 123.45.67.199

<VirtualHost 123.45.67.199>
	ServerName site-C.com
  DocumentRoot /var/www/sites/site-C/htdocs
</VirtualHost>


#####  site-D.com on 123.45.67.199

<VirtualHost 123.45.67.199>
	ServerName site-D.com
  DocumentRoot /var/www/sites/site-D/htdocs
</VirtualHost>
 
Old 10-17-2009, 06:11 AM   #2
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by AndyBG View Post
Hi folks,

I have been trying to figure this out for a few days now and I've pulled out most of my hair. Can someone please put me out of my misery ...

[ snip ]
You left something important out of your post. What problems are you having?
 
Old 10-17-2009, 06:17 AM   #3
AndyBG
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
My problem is...

Quote:
Originally Posted by AndyBG View Post
Code:
Browsing to www.site-C.com and www.site-D.com always shows site-C.
If I change the order so that site-D appears before site-C, then browsing to either will show site-D.
 
Old 10-17-2009, 03:21 PM   #4
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by AndyBG View Post
My problem is...
But they have the same address! I understand you think the server name should determine the ultimate destination, but maybe it would be a good idea to assign different IPs just as an experiment. Or different ports, if not IPs.

Code:
#####  site-C.com on 123.45.67.199

<VirtualHost 123.45.67.199>
	ServerName site-C.com
  DocumentRoot /var/www/sites/site-C/htdocs
</VirtualHost>


#####  site-D.com on 123.45.67.199

<VirtualHost 123.45.67.199>
	ServerName site-D.com
  DocumentRoot /var/www/sites/site-D/htdocs
</VirtualHost>
I would be curious to see what would happen if these two had different IPs.
 
  


Reply

Tags
virtualhost


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Name and IP based virtual host in Apache hifun Linux - Newbie 5 06-17-2009 02:06 PM
Adding virtual interface for IP based virtual host pridefc Linux - General 6 03-16-2008 04:52 PM
configuring secured name based virtual host bzlaskar Linux - Security 4 04-19-2007 06:05 AM
How to configure the virtual host based name? gz_xmg Linux - Networking 0 12-28-2004 02:12 AM
Name Based Virtual Host problem helios007 Linux - Networking 6 12-21-2003 04:41 PM


All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration