Solved

apache NameVirtualHost overlaps

Posted on 2009-04-15
4
553 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
  • 2
4 Comments
 
LVL 16

Expert Comment

by:ai_ja_nai
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
typooooo, my bad. I spelled domain name wrong. damn. Thanks alot
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now