% sudo gem install passenger
% sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.0.2.

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.
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/bin/rake
 * Apache 2... found at /usr/sbin/apache2
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... found
 * fastthread... found
 * rack... found

Some required software is not installed.
But don't worry, this installer will tell you how to install them.

Press Enter to continue, or Ctrl-C to abort.

と言うわけで,Apache2 の開発用パッケージが必要らしい.で,いろいろ調べると,

% sudo apache2 -V
Server version: Apache/2.2.9 (Debian)
Server built:   Jul 20 2008 08:23:41
Server's Module Magic Number: 20051115:15
Server loaded:  APR 1.2.12, APR-Util 1.2.12
Compiled using: APR 1.2.12, APR-Util 1.2.12
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

と言うことで,prefork-dev をインストール.

% sudo apt-get install apache2-prefork-dev


% sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module
The Apache 2 module was successfully installed.

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

   LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.0.2/ext/apache2/
   PassengerRoot /var/lib/gems/1.8/gems/passenger-2.0.2
   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

Press ENTER to continue.

Deploying a Ruby on Rails application: an example

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

   <VirtualHost *:80>
      DocumentRoot /somewhere/public

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

  /var/lib/gems/1.8/gems/passenger-2.0.2/doc/Users guide.html

Enjoy Phusion Passenger, a product of Phusion ( :-)

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


  • /etc/apache2/mods-available/passenger.load
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.0.2/ext/apache2/
  • /etc/apache2/mods-available/passenger.conf
PassengerRoot /var/lib/gems/1.8/gems/passenger-2.0.2
PassengerRuby /usr/bin/ruby1.8
  • シンボリックリンクを張る
% sudo ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
% sudo ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf
  • VirtualHostの設定
<VirtualHost *>
  DocumentRoot /path/to/app/public
  • fcgidを無効にしておく.
% sudo rm /etc/apache2/mods-enabled/fcgid.*
  • 再起動
% sudo apache2ctl restart

これで,http://localhost/ にアクセスすると,Railsのあの画面が表示される.


comments powered by Disqus