Odd Virtual Host Behavior

I've got several domains that point to the same IP.  Running Apache on that IP.

Here is what the section of httpd.conf looks like (note: IPs and domain names have been changed to protect the ignorant):

[CODE]
DocumentRoot "/usr/local/apache/htdocs"

....
....

NameVirtualHost *
NameVirtualHost !!!.!!!.!!!.!!!
ServerName domain1.com

<VirtualHost *:80>
DocumentRoot "/usr/local/apache/htsisters"
<Directory "/usr/local/apache/htsisters">
allow from all
Options +Indexes
</Directory>
ServerName domain2.net
</VirtualHost>

<VirtualHost domain3.net:80>
DocumentRoot /usr/local/apache/htbmnet
<Directory "/usr/local/apache/htbmnet">
allow from all
Options +Indexes
</Directory>
ServerName domain3.net
</VirtualHost>
[/CODE]

Now domain2 is not pointing properly at this time, so I don't know what its behavior is.  However when I browse to domain1.com, I get the pages for domain3.net.  I also get the pages for domain3.net when I browse to domain3.net.

I am having extreme trouble getting this to work  . . .
WarriorPoet42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrielfCommented:
Our httpd.conf is looks like this (I modified it for your needs) and works fine:


*********************************
ServerName localhost
ServerAdmin webmaster@domain1.net
DocumentRoot /usr/local/apache/htdocs


NameVirtualHost xxx.xxx.xxx.xxx

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain2.net
    DocumentRoot /usr/local/apache/htsisters
    ServerName domain2.net
    ServerAlias domain2.net
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain3.net
    DocumentRoot /usr/local/apache/htbmnet
    ServerName www.domain3.net
    ServerAlias domain3.net
</VirtualHost>

<VirtualHost _default_:*>
    ServerAdmin webmaster@domain1.net
    DocumentRoot /usr/local/apache/htdocs
</VirtualHost>
*********************************

Domain2 and Domain3 are named only, and all unknow domain will go to domain1 home...

0
mrielfCommented:
A little bug in first VirtualHost section:

ServerName www.domain2.net

:)
0
WarriorPoet42Author Commented:
OK, used your code.

Now what happens is domain1 shows me domain3's files

Domain2 shows the correct files

And, as I said, I cannot test what domain3 would show me.  Yet.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

mrielfCommented:
stupid question, but apache server was restarted?
0
WarriorPoet42Author Commented:
Not a stupid question.  But an easy answer: aye.
0
mrielfCommented:
Then I have no idea why this server works this way...
0
mrielfCommented:
Try to place a VirtualHost definition for domain1 too...

*********************************
ServerName localhost
ServerAdmin webmaster@domain1.net
DocumentRoot /usr/local/apache/htdocs


NameVirtualHost xxx.xxx.xxx.xxx

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain1.net
    DocumentRoot /usr/local/apache/htsisters
    ServerName www.domain1.net
    ServerAlias domain1.net
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain2.net
    DocumentRoot /usr/local/apache/htsisters
    ServerName www.domain2.net
    ServerAlias domain2.net
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain3.net
    DocumentRoot /usr/local/apache/htbmnet
    ServerName www.domain3.net
    ServerAlias domain3.net
</VirtualHost>

<VirtualHost _default_:*>
    ServerAdmin webmaster@domain1.net
    DocumentRoot /usr/local/apache/htdocs
</VirtualHost>
*********************************
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrielfCommented:
Eh copy/paste... of course another mistake... :)

<VirtualHost xxx.xxx.xxx.xxx>
    ServerAdmin webmaster@domain1.net
    DocumentRoot /usr/local/apache/htdocs
    ServerName www.domain1.net
    ServerAlias domain1.net
</VirtualHost>


0
mrielfCommented:
And if www.domain1.net still serve domain3.net files, then please look at your /usr/local/apache/htdocs directory and compare it to /usr/local/apache/htbmnet maybe files identical at both places....
0
WarriorPoet42Author Commented:
This appears to work.  However I cannot test the final domain.  Do before I give you the points, can I post to this question after the points have been awarded?
0
mrielfCommented:
yes
0
WarriorPoet42Author Commented:
I /will/ report after DNS gets fixed.  Thank you very much, mrielf.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.