Ruby-on-rails – Cannot access http://localhost:3000

localhostnetworkingruby-on-rails

I am trying to learn Ruby on Rails, I have followed the instructions from this page to get rails installed on my PC.

I am also trying to follow this webcast to try and learn the language and framework. Everything is working so far, apart from the fact that I cannot access

http://localhost:3000
http://0.0.0.0:3000
http://127.0.0.1:3000, or
http://<actual IP address>:3000

locally. If I try the from another PC on my network then it works great. I have tried in Chrome, Firefox and IE7 but none work.

Has anyone else had this problem?

EDIT: Typical!! It's started working now. I have no idea why, I am typing the exact same address in to the address bar and it now works. But only if I use http://127.0.0.1:3000, localhost doesn't work. I do run IIS ASP.NET/ASP websites on this machine, and they work fine with localhost.

EDIT 2: If I trying pinging localhost it actually says

Reply from ::1: time<1ms

0.0.0.0 yields…

PING: transmit failed, error code 1214

only 127.0.0.1 seems to work. I did have IPv6 turned on, so I've disabled that and will try again tomorrow to see if a reboot helps.

Best Answer

I had this issue as well with Vagrant. The secret is to run

bin/rails server -b 0.0.0.0

What 0.0.0.0 means is to listen to all interfaces, not just on localhost. The alternative is to SSH into the vagrant machine with a SOCKS proxy.

ssh -C -D 8080 vagrant@localhost

Open up your Internet explorer proxy settings and set the SOCKS v5 proxy to port 8080.

Related Topic