How to run Rack-based application (not Rails) with Unicorn

rack, ruby, unicorn

Solution

Unicorn does not give any special treatment to Rails 3+ applications, so the behavior is exactly the same for Rails 3+ applications and non-Rails Rack applications. Just run

unicorn

in your app's root. To run with a specific port, pass `-p/--port` with the port:

unicorn -p 4001

You can also specify the rackup file:

unicorn server.ru

You can see all the options by running `unicorn --help`. Of course, you should prepend `bundle exec` to these commands as needed by your setup.

Problem

How can I run a Rack-based application (not Rails) with unicorn? Let's assume I have a "hello world" response simple rack app with the name of `server.ru`, and config file at the same directory with the name of `unicorn.conf`, how am I supposed to run it? In Thin, for example, I would do something like: ``` bundle exec rackup server.ru -s thin -E production -p 4001 ``` How would I do the same to run under Unicorn?

Original source