Passengerのインストールメモ
passengerとnginxを連携してRailsを動かそうとしたくてpassengerをインスコした時のメモ。
やってみると、宿題をすべてやらないと帰宅させてくれない教師並にしんどかった。
インフラ力なくてつらいです。
Linux debian 2.6.32-5-amd64
$ gem install passenger
passengerはgem。インスコ後は以下を実行。
$ sudo passenger-install-nginx-module
$ これからが本当の地獄だ
$ passenger-install-nginx-module Welcome to the Phusion Passenger Nginx module installer, v2.2.14. This installer will guide you through the entire installation process. It shouldn't take more than 5 minutes in total. Here's what you can expect from the installation process: 1. This installer will compile and install Nginx with Passenger support. 2. You'll learn how to configure Passenger in Nginx. 3. You'll learn how to deploy a Ruby on Rails application. Don't worry if anything goes wrong. This installer will advise you on how to solve any problems. Press Enter to continue, or Ctrl-C to abort. -------------------------------------------- Checking for required software... * GNU C++ compiler... found at /usr/bin/g++ * Ruby development headers... found * OpenSSL support for Ruby... found * RubyGems... found * Rake... found at /usr/local/bin/rake * rack... found * OpenSSL development headers... found * Zlib development headers... found -------------------------------------------- Automatically download and install Nginx?
環境によってはnot foundのライブラリがあるのでそれをインストールするまで先を通してくれない。
未インストールライブラリある場合、次の画面をよくよくみるとインストールするべきライブラリ名がご丁寧に書いているのでそれをひとつずつやればよい。
間違ってもnot foundとなっているライブラリの説明でapt-cache searchでライブラリを探さないこと。
このあと
『ターミナルにnginxを入れるけどネットから落としてくる?それとも自分でコンパイルする?』って聞いてくる。今回は何も考えずネットから落としてきた。
すると、インストールするディレクトリを聞かれるのでそれっぽいパスを入力する。
(その後になんか聞かれたけど忘れた。)
Permission Demindが何度か出たので権限変更後に再実行する時にまたソースから落としてきたりしてた。レストランならクレームです。
こんな感じでpassengerと対話していくと以下のようなメッセージが表示された。
Deploying a Ruby on Rails application: an example Suppose you have a Ruby on Rails application in /somewhere. Add a server block to your Nginx configuration file, set its root to /somewhere/public, and set 'passenger_enabled on', like this: server { listen 80; server_name www.yourhost.com; root /somewhere/public; # <--- be sure to point to 'public'! passenger_enabled on; } And that's it! You may also want to check the Users Guide for security and optimization tips and other useful information: /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/doc/Users guide Nginx.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
たぶんおっけー。