Why would Webrick use 0.0.0.0:3000 instead of 127.0.0.1:3000


#1

Someone working through my Rolling with Ruby on Rails tutorial is having
this problem. Does anyone know what could cause it? I pasted the text of
his message below.

Thanks,
Curt

– Original Message –
I am using Instant Rails which comes with Rails 1.0, WEBrick 1.3.1 and
Ruby 1.8.2 and I ran the WEBrick server and it starts on
http://0.0.0.0:3000 and not http://127.0.0.1:3000. However, when I tried
to connect to http://0.0.0.0:3000 using my browser, a dialog pops up
telling me that “the connection was refused”. Any suggestions on how to
solve this problem?.


#2

Curt H. wrote:

Someone working through my Rolling with Ruby on Rails tutorial is having
this problem. Does anyone know what could cause it? I pasted the text of
his message below.

0.0.0.0 means “bind to all IP addresses”.


#3

Curt H. wrote:

http://0.0.0.0:3000 and not http://127.0.0.1:3000. However, when I tried
to connect to http://0.0.0.0:3000 using my browser, a dialog pops up
telling me that “the connection was refused”. Any suggestions on how to
solve this problem?.

I asked Dave T. (via the Errata) what the 0.0.0.0 meant when AWDR
first came out in beta, so he included the answer - it tells the server
to listen on all the host’s IP addresses.

That doesn’t imply that you can point your browser at 0.0.0.0 - although
that’s what DHH does in the Rails movie (and it works for me on the
Mac).

On Windows XP, running WEBrick from the Instant Rails command prompt, I
see the same “The connection was refused…” dialog if I try to browse
http://0.0.0.0:3000, but there’s no problem with browsing
http://localhost:3000.

Thanks for an excellent package… I just have a problem with, I think,
interactions between my normal MySQL installation and the Instant Rails
one. I’ve changed the socket that the Instant Rails MySQL runs on, but
(I just found out when anwering this post) if I try to run the Cookbook
application the attempt to connect to MySQL fails with “access denied”.
My normal MySQL setup has a root password.

regards

Justin


#4

if localhost:3000 doesn’t work, try 127.0.0.1:3000. If that doesn’t
work,
open the hosts file at,
Windows XP = C:\WINDOWS\SYSTEM32\DRIVERS\ETC
Windows 2K = C:\WINNT\SYSTEM32\DRIVERS\ETC
Win 98/ME = C:\WINDOWS

and add the following line to the end of the hosts file
(if it’s not there already),

127.0.0.1 localhost


#5

Justin F. wrote:

Thanks for an excellent package… I just have a problem with, I think,
interactions between my normal MySQL installation and the Instant Rails
one. I’ve changed the socket that the Instant Rails MySQL runs on, but
^^^^^^ port
(I just found out when anwering this post) if I try to run the Cookbook
application the attempt to connect to MySQL fails with “access denied”.
My normal MySQL setup has a root password.

My mistake - needed to change the Cookbook database config to use the
different port. To run it under WEBrick, I also needed to create a log
directory.

regards

Justin