0

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?

2 Answers 2

2

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
9
  • 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
    Commented Sep 12, 2011 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
    Commented Sep 12, 2011 at 13:39
  • facepalm....right, of course I knew that you meant the hosts file under Windows....let me give it a bash
    – Shalan
    Commented Sep 12, 2011 at 13:39
  • ok, edited it, but think I may need to restart my PC for the changes to take effect
    – Shalan
    Commented Sep 12, 2011 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
    Commented Sep 12, 2011 at 13:44
0

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .