Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Ubuntu guest VM operating inside Windows 7 host (VirtualBox with Bridged Networking enabled). In my VM, instead of browsing to http://localhost/somesite I set up virtual directories in apache to point to http://somesite. This is fine for when I'm working within Ubuntu, but I need to try to connect to the site from my Windows 7 host. If I enter 10.0.0.5 in my browser address bar, I do indeed see the apache welcome page, but how can I browse to my Virtual Directory/Site?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I don't know the Virtual Directory/Site feature, but if it is similar to the Virtual Hosts feature in WebSphere, setting up a hostname "somesite" with IP 10.0.0.5 in the Windows hosts file (default: C:\Windows\System32\drivers\etc\hosts) should work.

The entry would just look like this:

10.0.0.5 somesite

Please note that you need Administrator rights to edit this file in Windows 7. Easiest solution might be to open Notepad with those rights (right click -> run as Administrator) and then open the file from that editor.

Basically you need to instruct your browser to use that hostname for the Host field in the HTTP request (that is sent to the IP after resolving the hostname anyway) like this:

GET / HTTP/1.1
Host: somesite
share|improve this answer
    
Are you referring to the hosts file on Ubuntu? I'm sure that Apache is unaware of what IP the machine is on gets handed out. EDIT: just tried creating a new entry under /etc/hosts -> 10.0.0.5 somesite, and still cannot connect to it from Win7 if I type in that IP address –  Shalan Sep 12 '11 at 13:36
    
No, I mean the hosts file on the Windows machine (therefore provided the default Windows hosts file location). If you just use the browser with the IP address, Apache won't know which (virtual) hostname to use, as the browser won't provide one. –  BennyInc Sep 12 '11 at 13:39
    
facepalm....right, of course I knew that you meant the hosts file under Windows....let me give it a bash –  Shalan Sep 12 '11 at 13:39
    
ok, edited it, but think I may need to restart my PC for the changes to take effect –  Shalan Sep 12 '11 at 13:43
    
Editing the hosts file should not reed a restart - you can verify this by using ping somesite and checking the IP that gets pinged. –  BennyInc Sep 12 '11 at 13:44
show 4 more comments

I guess 10.0.0.5 is Ubuntu VM's IP address on the LAN. If you want to browse, you can use http://10.0.0.5/somesite. If you don't want to be using 10.0.0.5, AFAIK you need to redirect those requests using DNS (that is, translating somesite to 10.0.0.5).

share|improve this answer
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.