Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Wamp on my computer (the host). I have set up several virtualhosts in apache and they are working fine when I access them from the same computer (host).

I have installed Windows XPMode on my computer (which is running windows 7). XPMode (which uses Virtual PC) is set up to use a NAT network. The network in XPMode is working fine, and I can access the host PC via the IP address 192.168.1.5, just as I would if I was using any physical computer on the same network.

I can view all the web pages at 192.168.1.5 and it's subdirectories. However, I cannot access any of the subdomains that are configured in the virtualhosts of the host computer.

How can I access the subdomains? I don't think that the fact that I am using XPMode and am using a virtualized OS has anything to do with it, but I thought that it was worth mentioning.

share|improve this question

migrated from stackoverflow.com Mar 21 '10 at 1:17

This question came from our site for professional and enthusiast programmers.

1  
Doesn't belong on SO but in the meantime, what exactly do you mean by "subdomains"? From where are you trying to access them? –  Pekka 웃 Mar 21 '10 at 0:25
    
Apologies for asking this question in the wrong place! By subdomains I mean the subdomains (or at least, what looks like subdomains: app1.localhost) that I have setup using apache virtualhosts. I am trying to access them from within the virtual machine, though the same applies if I was to try and access them over the LAN. –  Pheter Mar 21 '10 at 0:54
add comment

1 Answer 1

up vote 1 down vote accepted

You need to add an entry to your hosts file so the vm knows which subdomain to open.

I'm not sure where the hosts file is on Win7 but on XP Professional it's at c:\windows\system32\drivers\etc\hosts.

Add a new line with the ip and subdomain name.

192.168.1.5 sub.domainname.com

share|improve this answer
    
I have already added the nessesary lines to my hosts file in Windows 7 (the host OS) and subdomains work fine on the host OS. I have tried doing the same to the guest OS (Windows XP) but it did not help. –  Peter Horne Mar 21 '10 at 14:38
    
I just tried adding the rules again to the hosts file on the guest OS. It now works, not sure why it didn't before, and I cannot set localhost to point to 192.168.1.5 but at least everything else works. Thanks! –  Peter Horne Mar 21 '10 at 14:42
    
Glad you got it to work. Btw, "localhost" is always 127.0.0.1. You shouldn't change this. en.wikipedia.org/wiki/Localhost –  anonymouse Mar 22 '10 at 5:37
    
I know, but as I'm not using the virtual machine for anything other than running ie6 I figured it would be worth tying out. I guess I'll just change both host files to use .local or something similar instead. –  Peter Horne Mar 23 '10 at 16:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.