简体   繁体   中英

How to use Phusion Passenger Standalone as the default Rails server

Due to some fancy tricks in my Rails app (and in the interest of making my dev setup look more like prod) I've started using Phusion Passenger Standalone as my development web server.

Currently I start it as $ bundle exec passenger start . If I run $ rails s it boots WEBrick, which is not what I want.

Is there a way to configure my app so I can run it the "usual way" as $ rails s ?

(Sorry if this is obvious, searching for the expected keywords on Google finds a lot of unrelated stuff...)

If you really want to force this, there's an easy hack that will do exactly what you want. You can modify your application's script/rails to catch all rails server calls and make a system call to start passenger, like so:

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

for more info check here https://groups.google.com/forum/#!topic/phusion-passenger/XBhlF5lRo2A

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM