Spec:
OS: Linux fedora 3.12.9-301.fc20.x86_64.
VirtualBox: 4.3.6
Vagrant: 1.4.3
I am trying to forward host's port 8080 to guest's port 80 using following vagrant configurations.
config.vm.network "private_network", ip: "192.168.56.101"
config.vm.network "forwarded_port", guest: 80, host: 8080
I've setup vhost on guest machine with servername local.example.com
.
I've added following line to host machine's /etc/hosts file
192.168.56.101 local.example.com
After vagrant up
without any error, if I try to access local.example.com
, the webpage cannot be found. However, if I use local.example.com:8080
, I can access it fine.
Why can't I access the vhost on guest machine using local.example.com
with port 80?
UPDATE 1
Inside of guest machine, if I use curl http://192.168.56.101
, I get right contents printed out in the terminal. If I use curl http://localhost
, I get the same contents as 192.168.56.101. So I assume 192.168.56.101 is correctly pointing to localhost.
UPDATE2
In my host machine, if I run curl http://192.168.56.101
, I get following error.
curl: (7) Failed connect to 192.168.56.101:80; Connection refused
If I run nc -v local.example.com
, nc -v local.example.com:8080
or nc -v 192.168.56.101
, I get following error.
UPDATE 3
I saw this command while searching for solution nmap -sS -P0 192.168.56.101/32
, and I ran it and got following result.
Nmap scan report for local.example.com (192.168.56.101)
Host is up (0.0000040s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 2.40 seconds
Does this look right?
UPDATE 4
Output of vagrant reload --debug
is in this link