Railsをpassengerで動かす

passengerをgemからインストール
sudo gem install passenger

問題なく入りました!

アパッチのモジュールをインストール
sudo passenger-install-apache2-module

がびーん!いろいろ足りなくてエラーになりました。
でも最近のインストラーは親切ですね。足りないライブラリを教えてくれます。

* GNU C++ compiler… found at /usr/bin/g++
* Ruby development headers… found
* OpenSSL support for Ruby… found
* RubyGems… found
* Rake… found at /usr/bin/rake
* Apache 2… found at /usr/sbin/apache2
* Apache 2 development headers… not found
* fastthread… found
* Apache Portable Runtime (APR) development headers… not found
* Apache Portable Runtime Utility (APU) development headers… not
* found

というわけで、足りないものをaptでインストール
sudo apt-get install apache2-threaded-dev libaprutil1-dev libapr1-dev

ubuntuはパッケージ管理が楽でいいっすよね。

sudo passenger-install-apache2-module

——————————————–
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

おし!インストール完了!
上記の設定をapache2.confに記述する。
RailsEnv production を設定すると好きなモードで動作させられるらしい。
production意外では動かさないと思うが一応メモ。

お約束のホスト設定

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.example.com
DocumentRoot /home/hogehoge/rails_root/hogehoge_foo/public
RailsBaseURI /

</VirtualHost>

そして再起動・・・
お願いします!
珍しく一発でできた!

This entry was posted on 火曜日, 7月 21st, 2009 at 11:40 AM and is filed under 日記. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply