How can I use unicorn as "rails s"?
It looks like the unicorn-rails
gem that @Dogbert mentioned can actually be used to make Unicorn the rails server
handler.
Simply include gem "unicorn-rails"
(and for Rails 4.2.4, gem "rack-handlers"
) in your Gemfile
, run bundle install
to install the gem, then you can run:
$ rails server unicorn
Although once unicorn-rails
is installed, Unicorn should be the default app server so you could also just run rails server
and it should use Unicorn (assuming you don't also have Thin or Mongrel in your Gemfile
, in which case they may conflict and you might want to remove the ones you're not using).
A better option might just be to run the unicorn server directly.
bundle exec unicorn -p 3000 # default port is 8080
gem 'rack-handlers'
rails server unicorn