rails 通过局域网ip连接访问本地Rails项目
2016-03-31 17:35
615 查看
新建的rails4.2.6项目,项目不能通过内网ip:3000访问,只能localhost:3000访问
由于Rails4.2之前都是默认绑定到 0.0.0.0,Rails 4.2 就默认绑定 localhost 了默认启动后控制台信息如下:
Rails 4.2.2 application starting in development on http://localhost:3000[/code]
通过IP访问要做如下修改:
进入项目下的config/boot.rb目录修改如下ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' # Set up gems listed in the Gemfile. require 'rubygems' require 'rails/commands/server' module Rails class Server alias :default_options_bk :default_options def default_options default_options_bk.merge!(Host: '0.0.0.0') end end end
启动后控制台信息如下:Rails 4.2.2 application starting in development on http://0.0.0.0:3000[/code]
相关文章推荐
- 【经典】有K张折扣券和m元最多能买多少物品(折前价ai,折后价bi)
- Unix Study之--AIX安装和配置SSH
- Unix Study之--AIX安装和配置SSH
- com.sun.mail.smtp.SMTPAddressFailedException: 550 Invalid User: "xxxxxxx@163.com"
- error LNK2005: _DllMain@12 已经在 MSVCRTD.lib(dllmain.obj) 中定义
- (4.5.3.6)failure [INSTALL_FAILED_NO_MATCHING_ABIS]
- Codeforces 145D Lucky Pair (组合计数)
- RAID5工作原理介绍
- Installation error: INSTALL_FAILED_OLDER_SDK
- 非调试模式下运行某项目但提示“is waiting for debugger......”
- poj2527——Polynomial Remains(多项式相除)
- KeyChain相关参数的说明
- crossDomain、allowDomain()、allowScriptAccess三者的关系解析
- how-to-stop-non-jailbroken-pirates-theory
- 对于 NSLayoutConstraint 不执行动画的处理:
- OC copy与retain的区别:
- 最近点对问题 POJ 3714 Raid && HDOJ 1007 Quoit Design
- IntelliJ IDEA 15.0.2导入grails工程
- LeetCode之旅(16)-Climbing Stairs
- LeetCode之旅(16)-Climbing Stairs