How to access the VirtualBox web server from the host

If you are looking for a way to access/connect to the webserver running inside your Ubuntu VirtualBox VM, from a Windows host, here are the steps.;

  • Run the webserver in Ubuntu VM (apache or Nginx)
  • Identify the port of the web server – by default, it is PORT 80
  • From VirtualBox host – VM settings, enable port forwarding

Let us do it in simple and straightforward 3 steps

Step #1 Start the webserver in the VM

First, ensure that the webserver is running in the VM, you may verify this by accessing the URL: localhost from a browser inside the VM

Or using the command:

# For Apache2
sudo systemctl status apache2.service

# For Nginx
sudo service nginx status

Once you are sure that the website is up and running, proceed to Step #2

Step #2 Enable port forwarding in VirtualBox VM

We are going to forward the Host machine’s ( your laptop’s ) PORT 80 to the VirtualBox VM’s PORT 80

For this, follow the below configuration steps

  • VirtualBox VM -> Settings
  • Network -> Attached to NAT
  • Expand Advanced and enable checkbox – Cable Connected
  • Click on Port Forwarding
  • Doubleclick, and enter the value 80, under Host PORT and Guest PORT, as shown here:

Save your settings by clicking OK.

Step #3 Accessing the URL from your host’s web-browser

Now open your host machine browser and enter localhost as the URL

Now, you should be seeing your Ubuntu-hosted webserver from your Windows Host!


This setup works, even if your machine is not connected to the internet (or has an external network).

You may also access the web server using a domain alias by entering them in your Windows hosts file. The host file is located at:


Make a new line entry for the test-domain name, such as for

Now, by entering this address in your browser, you can access the VM-hosted webserver from the host machine.