軽量・高速WebサーバThinを使う手順のメモ
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 scalability, performance and stability
- Rack, a minimal interface between webservers and Ruby frameworks
ということで、
RailsアプリケーションでThinを使う方法をメモしておきます。
何はともあれ、まずはsudo gem install thinで
thinをインストールします。
あとは、RAILS_ROOTで
shell>>
$ thin start
<<--
するだけでOKです。非常に簡単です。
thinコマンドのオプションは以下の通り。
pre>>
Usage: thin [options] start|stop|restart
Server options:
-a, --address HOST bind to HOST address
(default: 0.0.0.0)
-p, --port PORT use PORT (default: 3000)
-e, --environment ENV Rails environment
(default: development)
-c, --chdir PATH Change to dir before starting
-s, --servers NUM Number of servers to start
set a value >1 to start a cluster
-d, --daemonize Run daemonized in the background
-l, --log FILE File to redirect output
(default: log/thin.log)
-P, --pid FILE File to store PID
(default: tmp/pids/thin.pid)
-t, --timeout SEC Request or command timeout in sec
(default: 60)
-u, --user NAME User to run daemon as (use with -g)
-g, --group NAME Group to run daemon as (use with -u)
Common options:
-D, --debug Set debbuging on
-h, --help Show this message
-v, --version Show version
<<--
見ての通り、デフォルト設定はRailsアプリケーションに
最適化されています。