Software Development

Vagrant – Access Apache2 Web Server on virtual machine from host


This post shows how to configure vagrant to allow access to Apache2 web server (URL to Apache Ubuntu Default Page) running in virtual machine from the host system.


Stuff used in this post.

  • Windows 10 Enterprise
  • Vagrant 1.9.1
  • Vagrant-based development environment for WordPress from
    • On the Getting Started section, step 3 is not required
    • After configuring your vagrant, access the web server via
    • The virtual machine is a Ubuntu 16.04 Xenial64  box
    • When we start the virtual machine, Apache2 web server also starts

The Problem


After we start the virtual machine, Apache2 web server is not accessible.

Verify apache2 is running on the virtual machine

However, the web server is not accessible from the Windows host machine.


The Solution

The solution is to modify your Vagrantfile.


This file is generated in the directory where you performed the following vagrant command:

Actual command invocation

Modify Vagrantfile

Modify the vagrant file in the host system. The file’s contents look like this:


To fix our issue, we need to uncomment the highlighted line and restart our virtual machine.

Restart Virtual Machine

Invoke the following commands one after the other.

Stop VM


Start VM

Test Apache2 web server

We now can access the web server!

Web server now accessible from host system


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like