Apache redirecting to incorrect virtual server

I have a new installation CentOS 6.2 (Basic server + Development Tools Pkg + Virtualmin install script + Yum Update). I do not have a public IP: Using DynDNS Premium service and assigned a host name to the server which is redireted to my dynamic routable IP. I created three virtual servers and created a simple webpage for each one that just displays the website name. Each virtual server domain hostname is forwarded with masking to a DynDNS hostname pointed to my server's dynamic routable IP. Browsing to two of the virtual servers domains work fine but browsing to the third one gets redirected to the default virtual server. THe defaulkt virtual server access log shows the entry with the intended virtual server domain name. The correct virtual server access log shows nothing. Also, not always browing to domain.com instead of www.domain.com fails to read the index.html file and instead displays the "It Works" page.

Not sure what to check, any advise?

Status: 
Closed (fixed)

Comments

If you validate that domain in Virtualmin (at Limits and Validation -> Validate Virtual Servers), what does it report?

It validates fine: pisosdecaparra.com All features OK

However I've just noticed that under "Website Options-Default Website for IP Adress" it says yes but this is not the default website, the default website is another domain, the one that shows when I try to access pisosdecaparra.com. In other words there are 2 domains showing yes for "Website Options-Default Website for IP Adress".

Hi Jamie,

I went back to the "virgin" webmin installation ( I did this in VirtualBox so I had a snapshot at that point) and here is the order of things I did: 1)Created the virtual servers: 30daysrealty.com, compra-venta-pr.com, pisosdecaparra.com in that order 2)Validated the virtual servers, all validate OK 3)Created a simple index.html file in each virtual server public_html directory 4)Browsed to each site using the domain-name.com as address

All browsers point to the same website, the one for 30daysrealty.com

I have attached the access_log for the 30daysrealty.com website and the httpd.conf file for you to look at.

I appreciate you helping with this. I am trying to debug my installation before deploying to a VPS in the Internet.

Are your websites perhaps behind a NAT gateway of some kind? That can change the IP addresses the system receives connections on, and cause Apache to display the wrong site..

Hi Jamie, You can close this issue. It turns out the problem is in the way GoDaddy does domain forwarding: it makes use of an invisible frame thus my server never gets the hostname and it correctly presents the default website. I found this reference: http://www.linuxquestions.org/questions/linux-server-73/virtualhost-alwa... Which explains the issue, I just verified it by displaying the source page for my websites (should have thought about this earlier). I appreciate your time in looking at this issue and thank you immensely for doing so.

Regards

Ok, glad you figured it out!

Automatically closed -- issue fixed for 2 weeks with no activity.