Antony Scott
Antony Scott

Reputation: 21996

Cannot access http://localhost:3000

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.

Upvotes: 2

Views: 101623

Answers (8)

Yahs Hef
Yahs Hef

Reputation: 797

One way is to do the simple

    rails s

Another (more specifically) is

    rails start localhost 0.0.0.0

or

    rails start 0.0.0.0

another way is

    rails s 0.0.0.0

all of these works

Upvotes: 3

Bob
Bob

Reputation: 1095

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.

Upvotes: 9

Edoardo
Edoardo

Reputation: 87

I had your same identical problem. You have simply to run

$ rails server

from inside the folder of your application, not outside...so, if you have your application in

C:\Sites\myapp\blog

and blog is the folder where live your app, the command has to be prompted from here. Launching it from myapp folder won't work.

Upvotes: 1

mhartl
mhartl

Reputation: 1931

In order to access http://localhost:3000 you need to run the local Rails server in a terminal window:

$ rails server

This is described in this section of the Rails Tutorial book.

Note: I am the presenter of the screencasts in question.

Upvotes: 6

Sanel Babic
Sanel Babic

Reputation: 11

I had an epic issue with my System Path (Environmental Variable) not being set properly.

Simple copy paste job, unplugged the 1 week stalled Ruby installation.

Control Panel > System > Advanced tab > Environment Variables > System variables > Path... Edit...

Make sure it contains these paths (among others)...

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Upvotes: 1

Drew Noakes
Drew Noakes

Reputation: 311305

Can you telnet to the port? Try:

telnet localhost 3000

That should tell you if the ports unavailable at the TCP level, or whether something's going on at the HTTP level.

Ping might not work if ICMP is disabled, which could be completely unrelated to your issue.

Also, try looking in your hosts file for any redirections:

c:\Windows\System32\drivers\etc\hosts

Upvotes: 4

Jason Baker
Jason Baker

Reputation: 198797

Have you tried disabling your firewall? They can cause pesky problems at times.

Upvotes: 0

bluebrother
bluebrother

Reputation: 8906

Are you possibly using a proxy but haven't listed localhost as proxy exception?

Upvotes: 0

Related Questions