Created
February 26, 2013 14:00
-
-
Save tcaddy/5038600 to your computer and use it in GitHub Desktop.
Use Mongrel as the default Rails server in Rails 3.2.x instead of WEBrick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/mongrel.rb | |
# This will make Mongrel the default server in development | |
module Rack | |
module Handler | |
def self.default(options = {}) | |
# Guess. | |
if ENV.include?("PHP_FCGI_CHILDREN") | |
# We already speak FastCGI | |
options.delete :File | |
options.delete :Port | |
Rack::Handler::FastCGI | |
elsif ENV.include?("REQUEST_METHOD") | |
Rack::Handler::CGI | |
else | |
begin | |
Rack::Handler::Thin | |
rescue LoadError | |
if Rails.env.development? | |
# use Mongrel as default | |
Rack::Handler::Mongrel | |
else | |
# keep WEBrick as the default | |
Rack::Handler::WEBrick | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment