【发布时间】:2014-03-31 11:58:38
【问题描述】:
我已经开始学习 Ruby on rails,但无法在 Chrome 浏览器中打开 localhost:3000、0.0.0.0:3000 和 127.0.0.1:3000。
=> 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-03-31 14:40:49] INFO WEBrick 1.3.1
[2014-03-31 14:40:49] INFO ruby 2.1.0 (2013-12-25) [x86_64-linux]
[2014-03-31 14:40:49] INFO WEBrick::HTTPServer#start: pid=23204 port=3000
/etc/hosts
127.0.0.1 localhost
127.0.1.1 Hexbook.Dlink Hexbook
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 smxi.org
http://smxi.org smxi.org
209.197.72.47 smxi.org
在浏览器错误 ERR_INVALID_ARGUMENT
和卷曲:
root@Hexbook:/home/hexxy# curl 127.0.0.1:3000
curl: (7) couldn't connect to host
问题解决了:
ifconfig lo 127.0.0.1 up
【问题讨论】:
-
你在那里看到了什么?
-
你能告诉我们你的 /etc/hosts 文件的输出吗?
-
当你发出类似
curl 127.0.0.1:3000的问题时,你看到Connection refused了吗? -
在浏览器 ERR_INVALID_ARGUMENT curl: (7) 无法连接到主机
-
你的 Rails 服务器和你的浏览器在同一台机器上吗?
标签: ruby-on-rails ruby webrick