我用 virtualbox 搭了个 ubuntu server , 在上面启动了 rails 应用:
但是在本地主机无法访问:
本地主机可以 ping 通虚拟机:
这是什么原因造成的呢?
rails server -b 0.0.0.0 原因:rails 4.2.0 release note 里面搜索 rails server
rails server -b 0.0.0.0
rails server
#1 楼 @flowerwrong :plus1: 谢谢
,添加个原因,以备后用:
Running Rack apps on 0.0.0.0 in development mode will allow malicious users on the local network (exf: a Coffee Shop or a Conference) to abuse or potentially exploit the app.Safer to default host to localhost when in development mode.