gpt4 book ai didi

ruby-on-rails - 为什么 Rails 服务器在 tcp 上列出

转载 作者:行者123 更新时间:2023-12-04 11:16:57 24 4
gpt4 key购买 nike

我正在开发一个项目,该项目是新项目的更新版本。使用 vagrant 加载虚拟环境以及运行时

RAILS_ENV=development bundle exec rails s

返回以下内容:
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

当我访问浏览器时,我尝试了 localhost:3000 和 127.0.0.1:3000 但不断得到:
ERR_CONNECTION_REFUSED

在加载的不同存储库上的此项目的先前版本中,可以通过这些 URL 访问它。该项目已更新到 Rails 5,但不知道为什么它在监听 TCP 而不是 HTTP。有什么建议?

最佳答案

正如已经建议的那样,确保服务器绑定(bind)到 0.0.0.0,以便所有接口(interface)都可以访问它。
你可以试试:

RAILS_ENV=development bundle exec rails s -b 0.0.0.0

关于ruby-on-rails - 为什么 Rails 服务器在 tcp 上列出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42156673/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com