Thin は、最近話題の軽量・高速が売りのWebサーバです。
Thin is a Ruby web server that glues together 3 of the best Ruby libraries in web history:
- the Mongrel parser, the root of Mongrel speed and security
- Event Machine, a network I/O library with extremely high scalabilit
y, performanc e and stability - Rack, a minimal interface between webservers
and Ruby frameworks
ということで、
RailsアプリケーションでThinを使う方法をメモしておきます。
何はともあれ、まずはsudo gem install thin
で
thinをインストールします。
あとは、RAILS_ROOT
1 $ thin start
するだけでOKです。非常に簡単です。 thinコマンドのオプションは以下の通り。
1 Usage: thin [options] start|stop|restart 2 3 Server options: 4 -a, --address HOST bind to HOST address 5 (default: 0.0.0.0) 6 -p, --port PORT use PORT (default: 3000) 7 -e, --environment ENV Rails environmen t 8 (default: developmen t) 9 -c, --chdir PATH Change to dir before starting 10 -s, --servers NUM Number of servers to start 11 set a value >1 to start a cluster 12 -d, --daemoniz e Run daemonized in the background 13 -l, --log FILE File to redirect output 14 (default: log/thin.l og) 15 -P, --pid FILE File to store PID 16 (default: tmp/pids/t hin.pid) 17 -t, --timeout SEC Request or command timeout in sec 18 (default: 60) 19 -u, --user NAME User to run daemon as (use with -g) 20 -g, --group NAME Group to run daemon as (use with -u) 21 22 Common options: 23 -D, --debug Set debbuging on 24 -h, --help Show this message 25 -v, --version Show version
見ての通り、デフォルト設定はRailsアプリケーションに 最適化されています。
posted by
genki
on Sat 16 Feb 2008
at 12:48