apache2でPassenger 3.0を利用

Last Updated 2010-10-24


  1. インストール
  2. apacheから利用するための設定
  3. 注意


gemでPassenger 3.0をインストールします

# gem install passenger

Passenger 3.0では前と変わったのか、上記でapache用モジュールがデフォルトでインストール されていませんでした。そのため、以下のドキュメントに沿ってapache2用モジュールの作成を行いました。


Phusion Passenger users guid - 2. Installing, upgrading and uninstalling Phusion Passenger


ruby は CentOS 5.5 64bit版の場合、yumでインストールするとバージョンが1.8.5なので、 最新の1.9.2をソースからコンパイルして、/usr/local/にインストールしています。 apacheはyumで標準インストールしています。

# which httpd

# httpd -version
Server version: Apache/2.2.3
Server built:   Aug 30 2010 12:28:40

# which apxs

# which ruby

# ruby --version
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]


# /usr/local/bin/passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.0.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 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.

The Apache 2 module was successfully installed.

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

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0
   PassengerRuby /usr/local/bin/ruby

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

Press ENTER to continue.
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <:VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # <:-- be sure to point to 'public'!
      <:Directory /somewhere/public>
         AllowOverride all              # <:-- relax Apache security settings
         Options -MultiViews            # <:-- MultiViews must be turned off

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.