新手问题 本地 ip:3000 的方式访问不了 RoR 页面?

bja7456 · March 04, 2016 · Last by bja7456 replied at March 04, 2016 · 2277 hits

在我的机器上运行 rails 程序,localhost:3000 和 127.0.0.1:3000 都能正常访问; 但是用我的 ip:3000 就访问不了了; 请问如何能用 ip:3000 的方式访问?

rails s -b 0.0.0.0 然后在一个局域网里访问你的 ip

请查询 rails -help, 仔细阅读-b 的说明

楼主是不是使用的 Rails 4.2 以上?https://ruby-china.org/topics/28885

#3 楼 @zlx_star 是的,Rails 4.2 以后 server 默认监听 localhost 而不是之前的 0.0.0.0

You need to Sign in before reply, if you don't have an account, please Sign up first.