Skip to content

Instantly share code, notes, and snippets.

@naoto
Created October 31, 2010 09:42
Show Gist options
  • Save naoto/656359 to your computer and use it in GitHub Desktop.
Save naoto/656359 to your computer and use it in GitHub Desktop.
Unicorn で Sinatra を動かす最小設定

Sinatra on Unicorn

1.Install

$> gem install sinatra
$> gem install unicorn

2.SinatraApplication

$> vi app.rb

require 'rubygems'
require 'sinatra'

get '/' do
  "Hello World!"
end

3.Config.ru

$> vi config.ru

require 'app.rb'
run Sinatra::Application

4.Unicorn.conf

$> vi unicorn.conf

# ワーカーの数
worker_processes 2

# ソケット
listen '/tmp/unicorn.sock'
listen 80, :tcp_nopush => false

# ログ
stderr_path 'tmp/log/unicorn.log'
stdout_path 'tmp/log/unicorn.log'

5.Work Directory

$> mkdir tmp
$> mkdir tmp/log

6.Run

$> sudo unicorn -c unicorn.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment