Skip to content

Instantly share code, notes, and snippets.

@tcaddy
Created February 26, 2013 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcaddy/5038600 to your computer and use it in GitHub Desktop.
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
# 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