Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I always used XAMPP for my LAMP environment and developed directly on Windows 7. But now I want to do all my web development on Linux so I installed Ubuntu in virtualbox and installed PHP/MySQL and Apache individually.

I can access everything in the browser inside my VM, but now I want to access http://localhost in Windows. How can I do this, I assume it should be easy enough since both OS's are in the same internal network?

share|improve this question

migrated from Oct 22 '11 at 1:52

This question came from our site for system and network administrators.

As far as your Windows machine is concerned, the Ubuntu webserver in VirtualBox is a completely separate computer. 'localhost' won't work. So long as the Ubuntu Apache is binding eth0, you should be able to access the Ubuntu-based site via direct IP. for example.

You can find the IP of the Ubuntu install a couple of ways. /sbin/ifconfig eth0 being one of them. Use that IP address in the URL instead of localhost.

share|improve this answer
You can also try opening in the Internet browser on the VM. – bwDraco Oct 22 '11 at 3:41

VirtualBox provides several networking modes for attaching guests to the host machine. The default is NAT which by default does not expose the guest to the host. Check out which mode you are using by going to the settings window for your VM and clicking on the network tab. You'll see the Attached: property followed by a drop box.

If you're using the NAT mode we can use port forwarding to expose port 80 on the guest. Open the Advanced section on the networking settings window and click the Port Forwarding button. On the resulting dialogue we want to add an entry. Let's name it Web, the protocol will be TCP the host port can be any port you want to connect to on your windows box. Let's make it 80. The guest port needs to be 80 as that's what your web server is listening to on your linux guest VM. The Host IP and Guest IP can be left blank. Click OK for the dialogue and the setting window. Start up your VM and you should be able to connect to http://localhost from your windows machine.

For more information about how VirtualBox handles networking check out the documentation at

share|improve this answer

You must log in to answer this question.