I am new to Ubuntu and have Apache2 running in a virtual box on my machine. I am trying to access this server on my Windows machine.. I am assuming that I need to find the ipAddress and the port to access the server.

I have tried Identifying my IpAddress using the following


enter image description here

enter image description here

And then checking which port Apache is running

lsof -i etc..

enter image description here

I'm not really sure what all this information means.. But I am assuming that If I find the Ip Address and port I can navigate to it on my windows pc. e.g.

Anyway I have tried just about every cominbation of ipAdress/port listed and can't figure it out.

Do I need to implement any port forwarding? I found the following screen in my vm settings but don't know what to try from there.

enter image description here

Would appreciate any direction or guidance on how I can access the apache2 server.


There are a number of factors at play, mainly your Apache configuration and the network setup of your VM.

You are on the right track with the Apache setup, but I would use netstat to find the port your Apache is listening to:

gomo@wks120:~/$ sudo netstat -puant | grep apache | grep LISTEN
tcp        0      0    *               LISTEN      1577/apache2    
tcp        0      0   *               LISTEN      1577/apache2

This shows I have a process called apache2 with PID 1557 listening on port 80 and 443 on all interfaces (

For the network setup part, it depends on what type of networking you are using for your virtual machine (found in VirtualBox under each VM's Settings --> Network page. The most common options are either bridged or NAT.

Bridged means the VM will be granted access to the physical network your host computer is connected to. Things would work as if you plugged the VM onto the same switch your computer is plugged in to. You typically run virtualized servers this way.

NAT means a local network will be created just for your VMs. This is similar to how your average home router/wireless AP works: VMs can access outside networks (such as your LAN or the internet) but other computers can't reach your VMs.

All in all, set up bridged networking (restart the VM's network or the entire VM after changing this) and check your apache port. You should be able to connect without problems from your host machine.

  • This said, unless you changed something, it's pretty much 100% certain that your Apache is listening on port 80. If you "sudo grep -rni listen" in /etc/apache2/ you should find the relevant configuration directives. – GomoX Jan 10 '14 at 15:06
  • Thank you for your answer, I'll follow your advice when I get a chance to work on it this weekend and will get back to you or accept your answer. – Trevor Jan 10 '14 at 15:51
  • Thanks again, your explanation of the Bridged and Nat options helped a lot! I was able to access the server :) – Trevor Jan 11 '14 at 4:13

Stop your VM and open its settings in the VirtualBox (OSE) Manager Go to the Network tab Select the network mode to host-only

Save the settings Start the Ubuntu VM

  • Why do you think that "host only" is appropriate here? – guntbert Dec 26 '15 at 19:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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