?
Solved

apache NameVirtualHost overlaps

Posted on 2009-04-15
4
Medium Priority
?
564 Views
Last Modified: 2012-05-06
I have followed the namevirtualhost settings on apache's website. I dont know where i'm getting it wrong, as the first virtualhost overrides the other.

When I type www.domain1.com it's fine, but when I type www.domain2.com it shows me the content of domain1.

When I change the order, then the domain2 overrides/overlaps domain1.

Help please!! below is the virtual hosts config.


Thanks
NameVirtualHost *:80
 
 
<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com *.domain1.com
DocumentRoot /var/www/html/domain1
</VirtualHost>
 
<VirtualHost *:80>
ServerName www.domain2.com
ServerAlias domain2.com *.domain2.com
DocumentRoot /var/www/html/domain2
</VirtualHost>

Open in new window

0
Comment
Question by:GuildOfDruids
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24146585
of course, you set aliases for the host namevirtualhost (which is *); and the order determines the priority; this means that domain1.com has higher priority over domain2.com
look here(http://httpd.apache.org/docs/1.3/vhosts/examples.html#purename)
0
 

Author Comment

by:GuildOfDruids
ID: 24146623
Yes but want if I type domain1.com it should show me the content inside domain1 folder and same for domain2, how is that possible?
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 2000 total points
ID: 24147965
It looks like the ServerName/ServerAlias of your second vhost does not match for some reason. Could there be any additional non-visible character such as a special whitespace treated as character or something similar?
0
 

Author Closing Comment

by:GuildOfDruids
ID: 31570343
typooooo, my bad. I spelled domain name wrong. damn. Thanks alot
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What You Need to Know when Searching for a Webhost Provider
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question