【问题标题】:unable to open localhost on Debian无法在 Debian 上打开 localhost
【发布时间】:2014-03-31 11:58:38
【问题描述】:

我已经开始学习 Ruby on rails,但无法在 Chrome 浏览器中打开 localhost:30000.0.0.0:3000127.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


【解决方案1】:

很可能其他应用程序正在使用该端口。

您可以尝试找出它是哪一个,或者您可以尝试使用另一个端口,通常通过一些 -p 或类似的开关。

【讨论】:

  • 我尝试在浏览器中使用3001、3008、8808同样的错误
猜你喜欢
  • 1970-01-01
  • 2012-03-11
  • 2018-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多