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 installed VirtualBox on my Windows 7 machine. Through VirtualBox, I installed Ubuntu 9.10 with apache2. I can view http://localhost from Ubuntu, but is there anyway I can view it from my windows machine too? i.e. run the apache server on ubuntu, and view it from windows? I figured it would open a port or something that would be visible to my whole computer regardless of its virtualness, but I guess not. How do I get around this?

share|improve this question
add comment

3 Answers

Open port 80 in the VM, then go to the IP address of the VM in your browser.

share|improve this answer
    
how do I open port 80? –  Mark Apr 5 '10 at 17:02
    
I don't actually know Ubuntu well enough to be able to tell you. Take a look under System | Administration. –  Ignacio Vazquez-Abrams Apr 5 '10 at 17:04
    
According to the tutorial I found, I had to do it through the host OS/Windows actually... –  Mark Apr 5 '10 at 17:16
add comment

While the Virtualbox is powered down, create a secondary network connection of type "host only".

Power up your Virtualbox and run ifconfig from the command line.

The IP address you are looking for is in the second paragraph (mine is 192.168.56.101).


Optional: Add the following to your Windows hosts file:

192.168.56.101 ubuntu

Now you can go straight to http://ubuntu/.

share|improve this answer
add comment
up vote 0 down vote accepted

http://allisterx.blogspot.com/2008/05/web-server-on-virtualbox-gues-os.html

Edit: I should elaborate a bit. Here's the important bit from the tutorial. You need to run this on your Windows host OS.

cd C:\Program Files\Sun\xVM VirtualBox
VBoxManage setextradata MyLinux "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/HostPort" 8888
VBoxManage setextradata MyLinux "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/GuestPort" 80
VBoxManage setextradata MyLinux "VBoxInternal/Devices/pcnet/0/LUN#0/Config/apache/Protocol" TCP
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.