Solved

apache NameVirtualHost overlaps

Posted on 2009-04-15
4
561 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 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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