passenger : gem install on Debian

gem でpassengerをまず入れます。

LennyOne:~/bin# gem install passenger
Install required dependency rake? [Yn]  Y
Building native extensions.  This could take a while…
Successfully installed passenger-2.2.2
Successfully installed rake-0.8.7
Installing ri documentation for passenger-2.2.2…
Installing ri documentation for rake-0.8.7…
Installing RDoc documentation for passenger-2.2.2…
Installing RDoc documentation for rake-0.8.7…

次にnginxをインストール。

LennyOne:~/bin# passenger-install-nginx-module
Welcome to the Phusion Passenger Nginx module installer, v2.2.2.

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.
1

——————————————–

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
* fastthread… found
* Zlib development headers… found

——————————————–

Automatically download and install Nginx?

Nginx doesn’t support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 0.6.36 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx’s
    ‘configure’ script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the ‘configure’ script according to your
    instructions, and  3) run ‘make install’.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort: 2

ここで2を選択するのがポイントです。

——————————————–

PCRE (required by Nginx) not installed, downloading it…
# wget -O /tmp/pcre-7.8.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz
–2009-06-17 16:15:46–  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.8.tar.gz
           => `/tmp/pcre-7.8.tar.gz’
ftp.csx.cam.ac.uk をDNSに問いあわせています… 131.111.8.80
ftp.csx.cam.ac.uk|131.111.8.80|:21 に接続しています… 接続しました。
anonymous としてログインしています… ログインしました!
==> SYST … 完了しました。    ==> PWD … 完了しました。
==> TYPE I … 完了しました。  ==> CWD /pub/software/programming/pcre … 完了しました。
==> SIZE pcre-7.8.tar.gz … 1168513
==> PASV … 完了しました。    ==> RETR pcre-7.8.tar.gz … 完了しました。
長さ: 1168513 (1.1M)

100%[==================================================================================================================================================================>] 1,168,513    167K/s 時間 11s

Extracting PCRE source tarball…
# tar xzvf pcre-7.8.tar.gz
pcre-7.8/
pcre-7.8/doc/
:

pcre-7.8/pcre_chartables.c.dist
pcre-7.8/pcre_refcount.c

——————————————–

Where is your Nginx source code located?

Please specify the directory: /tmp/nginx-0.6.36

——————————————–

Where do you want to install Nginx to?

Please specify a prefix directory [/opt/nginx]:

——————————————–

Extra Nginx configure options

If you want to pass extra arguments to the Nginx ‘configure’ script, then
please specify them. If not, then specify nothing and press Enter.

If you specify nothing then the ‘configure’ script will be run as follows:

  ./configure –prefix=’/opt/nginx’ –with-pcre=’/tmp/pcre-7.8′ –add-module=’/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/nginx’

Extra arguments to pass to configure script: –with-md5=/usr/lib –with-sha1=/usr/lib –with-http_ssl_module

——————————————–

Confirm configure flags

The Nginx configure script will be run as follows:

  ./configure –prefix=’/opt/nginx’ –with-pcre=’/tmp/pcre-7.8′ –add-module=’/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/nginx’ –with-md5=/usr/lib –with-sha1=/usr/lib –with-http_ssl_module
7m

Is this what you want? (yes/no) [default=yes]:

——————————————–

——————————————–

Compiling Passenger support files…
# /usr/bin/ruby1.8 -S /usr/bin/rake clean nginx
(in /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2)
rm -rf ext/apache2/Configuration.o ext/apache2/Bucket.o ext/apache2/Hooks.o ext/apache2/mod_passenger.o ext/apache2/mod_passenger.so
rm -rf ext/nginx/HelperServer
rm -r pkg
cd ext/phusion_passenger && make clean
rm -f ext/phusion_passenger/Makefile
rm -rf ext/apache2/libboost_oxt.a ext/apache2/libboost_oxt
rm -rf ext/apache2/libpassenger_common.a ext/apache2/ApplicationPoolServerExecutable ext/apache2/libpassenger_common
rm -rf ext/nginx/libboost_oxt.a ext/nginx/libboost_oxt
rm -rf ext/nginx/libpassenger_common.a ext/nginx/libpassenger_common
rm -rf test/libboost_oxt.a test/libboost_oxt
rm -rf test/libpassenger_common.a test/ApplicationPoolServerExecutable test/libpassenger_common
rm -rf test/oxt/oxt_test_main test/oxt/*.o test/CxxTests test/*.o
mkdir -p ext/nginx/libboost_oxt/boost
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/boost/thread.o -c ext/boost/src/pthread/thread.cpp
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/boost/exceptions.o -c ext/boost/src/pthread/exceptions.cpp
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/boost/once.o -c ext/boost/src/pthread/once.cpp
mkdir -p ext/nginx/libboost_oxt/oxt
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/oxt/thread.o -c ext/oxt/thread.cpp
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/oxt/tracable_exception.o -c ext/oxt/tracable_exception.cpp
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/oxt/system_calls.o -c ext/oxt/system_calls.cpp
g++ -Iext  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libboost_oxt/oxt/backtrace.o -c ext/oxt/backtrace.cpp
mkdir -p ext/nginx/libboost_oxt/boost ext/nginx/libboost_oxt/oxt
rm -rf ext/nginx/libboost_oxt.a
ar cru ext/nginx/libboost_oxt.a ext/nginx/libboost_oxt/boost/*.o ext/nginx/libboost_oxt/oxt/*.o
ranlib ext/nginx/libboost_oxt.a
mkdir -p ext/nginx/libpassenger_common
g++ -Iext -Iext/common  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libpassenger_common/Utils.o -c ext/common/Utils.cpp
g++ -Iext -Iext/common  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libpassenger_common/Logging.o -c ext/common/Logging.cpp
g++ -Iext -Iext/common  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libpassenger_common/SystemTime.o -c ext/common/SystemTime.cpp
g++ -Iext -Iext/common  -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/nginx/libpassenger_common/CachedFileStat.o -c ext/common/CachedFileStat.cpp
mkdir -p ext/nginx/libpassenger_common
rm -rf ext/nginx/libpassenger_common.a
ar cru ext/nginx/libpassenger_common.a ext/nginx/libpassenger_common/*.o
ranlib ext/nginx/libpassenger_common.a
g++ ext/nginx/HelperServer.cpp -o ext/nginx/HelperServer -Iext -Iext/common -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS  ext/nginx/libpassenger_common.a ext/nginx/
libboost_oxt.a -lpthread
cd ext/phusion_passenger && /usr/bin/ruby1.8 extconf.rb
creating Makefile
cd ext/phusion_passenger && make
cc -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -D_FILE_OFFSET_BITS=64  -fPIC -fno-strict-aliasing -g -g -O2  -fPIC   -c native_support.c
cc -shared -o native_support.so native_support.o -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic    -lruby1.8

——————————————–

Compiling and installing Nginx…
# ./configure –prefix=’/opt/nginx’ –with-pcre=’/tmp/pcre-7.8′ –add-module=’/usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/nginx’ –with-md5=/usr/lib –with-sha1=/usr/lib –with-http_ssl_module
checking for OS
+ Linux 2.6.26-2-686 i686

checking for struct tm.tm_gmtoff … found

Configuration summary
  + using PCRE library: /tmp/pcre-7.8
  + using system OpenSSL library
  + using md5 library: /usr/lib
  + using sha1 library: /usr/lib
  + using system zlib library

  nginx path prefix: "/opt/nginx"
  nginx binary file: "/opt/nginx/sbin/nginx"
  nginx configuration prefix: "/opt/nginx/conf"
  nginx configuration file: "/opt/nginx/conf/nginx.conf"
  nginx pid file: "/opt/nginx/logs/nginx.pid"
  nginx error log file: "/opt/nginx/logs/error.log"
  nginx http access log file: "/opt/nginx/logs/access.log"
  nginx http client request body temporary files: "/opt/nginx/client_body_temp"
  nginx http proxy temporary files: "/opt/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/opt/nginx/fastcgi_temp"

# make
make -f objs/Makefile
make[1]: ディレクトリ `/tmp/nginx-0.6.36′ に入ります

:

# make install
make -f objs/Makefile install
make[1]: ディレクトリ `/tmp/nginx-0.6.36′ に入ります
test -d ‘/opt/nginx’ || mkdir -p ‘/opt/nginx’
test -d ‘/opt/nginx/sbin’               || mkdir -p ‘/opt/nginx/sbin’
test ! -f ‘/opt/nginx/sbin/nginx’               || mv ‘/opt/nginx/sbin/nginx’                   ‘/opt/nginx/sbin/nginx.old’
cp objs/nginx ‘/opt/nginx/sbin/nginx’
test -d ‘/opt/nginx/conf’               || mkdir -p ‘/opt/nginx/conf’
cp conf/koi-win ‘/opt/nginx/conf’
cp conf/koi-utf ‘/opt/nginx/conf’
cp conf/win-utf ‘/opt/nginx/conf’
test -f ‘/opt/nginx/conf/mime.types’            || cp conf/mime.types ‘/opt/nginx/conf’
cp conf/mime.types ‘/opt/nginx/conf/mime.types.default’
test -f ‘/opt/nginx/conf/fastcgi_params’                || cp conf/fastcgi_params ‘/opt/nginx/conf’
cp conf/fastcgi_params          ‘/opt/nginx/conf/fastcgi_params.default’
test -f ‘/opt/nginx/conf/nginx.conf’            || cp conf/nginx.conf ‘/opt/nginx/conf’
cp conf/nginx.conf ‘/opt/nginx/conf/nginx.conf.default’
test -d ‘/opt/nginx/logs’               || mkdir -p ‘/opt/nginx/logs’
test -d ‘/opt/nginx/logs’ ||            mkdir -p ‘/opt/nginx/logs’
test -d ‘/opt/nginx/html’               || cp -r html ‘/opt/nginx’
test -d ‘/opt/nginx/logs’ ||            mkdir -p ‘/opt/nginx/logs’
make[1]: ディレクトリ `/tmp/nginx-0.6.36′ から出ます

——————————————–

Nginx with Passenger support was successfully installed.

Please edit your Nginx configuration file (probably /opt/nginx/conf/nginx.conf),
and set the passenger_root and passenger_ruby configuration options in the
‘http’ block, like this:

  http {
      …
      passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2;
      passenger_ruby /usr/bin/ruby1.8;
      …
  }

After you (re)start Nginx, you are ready to deploy any number of Ruby on Rails
applications on Nginx.

Press ENTER to continue.

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 http://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-2.2.2/doc/Users guide Nginx.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl)🙂
http://www.modrails.com/

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

カテゴリー: 未分類 パーマリンク

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中