如何使用Phusion Passenger Standalone作为默认的Rails服务器

时间:2013-10-29 20:44:27

标签: ruby-on-rails ruby-on-rails-3 passenger

由于我的Rails应用程序中有一些花哨的技巧(并且为了让我的开发设置看起来更像prod),我已经开始使用Phusion Passenger Standalone作为我的开发Web服务器。

目前我以$ bundle exec passenger start开头。如果我运行$ rails s它会启动WEBrick,这不是我想要的。

有没有办法配置我的应用,以便我可以像$ rails s那样“通常的方式”运行它?

(很抱歉,如果这很明显,在Google上搜索预期的关键字会发现很多不相关的内容......)

1 个答案:

答案 0 :(得分:4)

如果你真的想强迫这个,那就是一个简单的黑客攻击,它将完全符合你的要求。 您可以修改应用程序的脚本/ rails以捕获所有rails服务器调用并进行系统调用以启动乘客,如下所示:

if (ARGV.first == 'server' || ARGV.first == 's')
  system("passenger start #{ARGV.shift.join(" ")}")
else
  # The old content of the script goes here
  APP_PATH = File.expand_path('../../config/application',  __FILE__)
  require File.expand_path('../../config/boot',  __FILE__)
  require 'rails/commands'
end

了解更多信息,请点击此处https://groups.google.com/forum/#!topic/phusion-passenger/XBhlF5lRo2A

相关问题