我无法 ping http://localhost:3000从我的终端运行 Webrick。 但是,在网络浏览器上加载它时,我得到默认的“欢迎出国”页面。 我将 Rails 用作移动应用程序的后端服务 - 因此我需要以这种方式访问 API。
>ping http://localhost:3000/
ping: cannot resolve http://localhost:3000/: Unknown host
>ping http://127.0.0.1
ping: cannot resolve http://127.0.0.1: Unknown host
>ping http://127.0.0.1:3000
ping: cannot resolve http://127.0.0.1:3000: Unknown host
最佳答案
ping
命令发送 ICMP 数据包并且不知道 URL 是什么,它 pre-dates the web by about ten years .它需要一个主机名,例如:
ping localhost
您想要的是使用像 curl
或 wget
这样的网络工具来访问您的页面:
curl http://localhost:3000/
关于ruby-on-rails - 无法 ping http ://localhost:3000 with Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31036657/