Windows – Can’t connect to WebServer inside (Vagrant) Virtualbox

vagrantvirtualboxwindows

I have a Vagrant Box with Virtualbox as the provider. The guest OS is Windows Server 2012 R2. I use the private network setting from vagrant with an arbitrary ip, which is unique.
In the box, I have a Apache installed. I get a response from within the vm, if I open a browser. But when I try to connect from my host to the guest I get nothing at all.
I have checked if the "Listen" directiv is set to localhost only, but it isnt. It is set to *:8080
How can I get a response in the host?

Best Answer

You need to forward the port to the guest machine. See: https://docs.vagrantup.com/v2/networking/forwarded_ports.html

Vagrant.configure("2") do |config|
  config.vm.network "forwarded_port", guest: 8080, host: 8080
end