I am learning Ruby on Rails with railstutorial.org and met this strange problem.
I ran "rails server" and the following information showed:
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-04-02 01:28:18] INFO WEBrick 1.3.1
[2014-04-02 01:28:18] INFO ruby 2.0.0 (2014-02-24) [x86_64-darwin12.5.0]
[2014-04-02 01:28:18] INFO WEBrick::HTTPServer#start: pid=13004 port=3000
I try connecting to localhost:3000 on various browsers and they all cannot establish a connection to the server.
I also tried rails server -p 3001 and connect to localhost:3001, which failed as well.
However, I tried 0.0.0.0:3000 , 127.0.0.1:3000, both of them worked and rendered the default welcome for rails.
Then I tried localhost:80, which successfully told me "It Works" and I can actually connect to my another local project using PHP+Apache.
So I really wonder why this happens and could anyone possibly give me any hint on it.
Thank you in advance:)
telnet localhost 3000
– Rajdeep Singhcat /etc/hosts
) file, it should contains this line127.0.0.1 localhost
– Kalpesh Fulpagarehttp://lvh.me:3000
-> it's a domain which points to your localhost, so you can test subdomains – Richard Peck