Reputation: 751
I'm trying to run a Rails app from my Ubuntu 12.04 64-bit virtual machine on Vagrant. Either running rails server
or rails server -b 0.0.0.0
works, but in both cases when I try to reach localhost:3000
or 0.0.0.0:3000
from my local Windows 10 machine, it says ERR_CONNECTION_REFUSED
.
I also put this line in the Vagrantfile:
config.vm.network "forwarded_port", guest: 3000, host: 3000
which should theoretically allow port forwarding on 3000, but when I run netstat -ntlp
I get:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:50891 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::111 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::36063 :::* LISTEN -
so somehow my Vagrant machine is not listening to port 3000 anyway.
I also tried to vagrant reload
, to no avail.
Rails version is 5.0.1.
Where am I failing? Thanks in advance.
Upvotes: 1
Views: 1014
Reputation: 751
Solved. The line in the Vagrantfile must be:
config.vm.network :forwarded_port, guest: 3000, host: 3000
so with a colon instead of quotes.
Upvotes: 3