Vagrant host port ignored
vagrant, web, workflow
Solution
By default Vagrant Boxes use NAT mode, it means that the guests are behind a `router` (VirtualBox Networking engine between the host and the guest) which maps traffic from and to the virtual machine transparently. The guests are invisible and unreachable from the host.
That's why we need port forwarding. Otherwise services running on guest wont' be accessible.
In your case, you are using Private Network, the guest will be assigned a private IP address that ONLY the host can access, which is `192.168.33.10`.
The proper way to access web hosted on the guest is => `http://192.168.33.10` from the host.
You have the port forwarding part in the `Vagrantfile`
www.vm.network :forwarded_port, guest: 80, host: 8888 # Apache port
It is forwarding guest port 80 to your host's 8888. Because you are NOT using NAT mode I am pretty sure it will be ignored. Try to `curl -Is http://localhost:8888`.
NOTE: even if it still work somehow, you should be accessing web by => `http://localhost:8888/` from your host.
Problem
In my Vagrantfile I have the definition of my development machine with a private network ip of 192.168.33.10 and a forwarded port of "guest=80, host=8888", but when a run my vagrant enviroment and I try to run curl -i 192.168.33.10:8888 I get an error saying 'Failed connect to 192.168.33.10:8888; connection refused', but when I try to connect to 192.168.33.10:80 everything it's ok. My Vagrantfile is: ``` Vagrant::configure("2") do |config| config.vm.box = "precise32" config.vm.define :web do |www| www.vm.hostname = "apache" www.ssh.max_tries = 10 www.vm.network :forwarded_port, guest: 80, host: 8888 # Apache port www.vm.network :private_network, ip: "192.168.33.10" www.vm.synced_folder "www", "/var/www", :extra => 'dmode=777,fmode=777' end end ``` Why this happens? is vagrant ignoring the forwarded port?