Passenger (mod_rails) を入れた


Passenger (mod_rails) を入れた。以下、手順。

$ sudo yum install gcc-c++ httpd-devel ruby-sqlite3
$ sudo gem install passenger
$ sudo passenger-install-apache2-module

インストールはたったこれだけ。次に httpd.conf に追記する。

# Configure for Passenger
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.4/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.4/bin/passenger-spawn-server
RailsRuby /usr/bin/ruby

テスト用に適当な Rails アプリケーションを作成する。

$ rails railstest

railstest/public を DocumentRoot にしないといけないので今回は Alias で対応。

# Configure for Rails test
Alias /home/hoge/railstest/public
<Directory /home/hoge/railstest/public>
AllowOverride all
Order deny,allow
Allow from all
</Directory>

railstest/public/.htaccess の 29 行目当たりに以下を追加。

RewriteBase /railstest

railstest ディレクトリを Apache が読み書きできるようにする。

$ chown -R apache:apache railstest

Apache を再起動する。

$ sudo /sbin/servie httpd restart

http://xxx.xxx.xxx.xxx/railstest/ にアクセスして About your application environment をクリックしてエラーが出なければとりあえず OK。

カテゴリー: Apache, Ruby   パーマリンク

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>