■構成情報
・OS: CentOS5.7(64bit)
・MySQL: 5.0.77(OSバンドル)
・Ruby: 1.8.7(Ruby Enterprise Editionを利用)
・rack: 1.1.1
・rake: 0.8.7
・i18n: 0.4.2
・Apache: 2.2.3(OSバンドル)
・Passenger: 3.0.9
・Redmine: 1.2.1
(4) ApacheにPassengerを組み込み
■パッケージを準備
[root@redmine01 ~]# rpm -q httpd-devel
パッケージ httpd-devel はインストールされていません。
[root@redmine01 ~]# yum -y install httpd-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: www.ftp.ne.jp
* extras: www.ftp.ne.jp
* updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd-devel.i386 0:2.2.3-53.el5.centos.1 set to be updated
--> Processing Dependency: httpd = 2.2.3-53.el5.centos.1 for package: httpd-devel
--> Processing Dependency: apr-util-devel for package: httpd-devel
--> Processing Dependency: apr-devel for package: httpd-devel
---> Package httpd-devel.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
--> Running transaction check
---> Package apr-devel.x86_64 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-util-devel.x86_64 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: httpd = 2.2.3-53.el5.centos for package: mod_ssl
--> Processing Dependency: httpd = 2.2.3-53.el5.centos for package: httpd-manual
---> Package httpd.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
--> Running transaction check
---> Package httpd-manual.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
---> Package mod_ssl.x86_64 1:2.2.3-53.el5.centos.1 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Installing:
httpd-devel i386 2.2.3-53.el5.centos.1 updates 151 k
httpd-devel x86_64 2.2.3-53.el5.centos.1 updates 151 k
Installing for dependencies:
apr-devel x86_64 1.2.7-11.el5_6.5 base 238 k
apr-util-devel x86_64 1.2.7-11.el5_5.2 base 53 k
Updating for dependencies:
httpd x86_64 2.2.3-53.el5.centos.1 updates 1.2 M
httpd-manual x86_64 2.2.3-53.el5.centos.1 updates 815 k
mod_ssl x86_64 1:2.2.3-53.el5.centos.1 updates 94 k
Transaction Summary
==========================================================================================================================
Install 4 Package(s)
Upgrade 3 Package(s)
Total download size: 2.7 M
Downloading Packages:
(1/7): apr-util-devel-1.2.7-11.el5_5.2.x86_64.rpm | 53 kB 00:00
(2/7): mod_ssl-2.2.3-53.el5.centos.1.x86_64.rpm | 94 kB 00:00
(3/7): httpd-devel-2.2.3-53.el5.centos.1.x86_64.rpm | 151 kB 00:00
(4/7): httpd-devel-2.2.3-53.el5.centos.1.i386.rpm | 151 kB 00:00
(5/7): apr-devel-1.2.7-11.el5_6.5.x86_64.rpm | 238 kB 00:00
(6/7): httpd-manual-2.2.3-53.el5.centos.1.x86_64.rpm | 815 kB 00:00
(7/7): httpd-2.2.3-53.el5.centos.1.x86_64.rpm | 1.2 MB 00:00
---------------------------------------------------------------------------------------------------------------------------
Total 1.2 MB/s | 2.7 MB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : httpd 1/10
Installing : apr-devel 2/10
Updating : mod_ssl 3/10
Installing : apr-util-devel 4/10
Updating : httpd-manual 5/10
Installing : httpd-devel 6/10
Installing : httpd-devel 7/10
Cleanup : httpd-manual 8/10
Cleanup : httpd 9/10
Cleanup : mod_ssl 10/10
Installed:
httpd-devel.i386 0:2.2.3-53.el5.centos.1 httpd-devel.x86_64 0:2.2.3-53.el5.centos.1
Dependency Installed:
apr-devel.x86_64 0:1.2.7-11.el5_6.5 apr-util-devel.x86_64 0:1.2.7-11.el5_5.2
Dependency Updated:
httpd.x86_64 0:2.2.3-53.el5.centos.1 httpd-manual.x86_64 0:2.2.3-53.el5.centos.1 mod_ssl.x86_64 1:2.2.3-53.el5.centos.1
Complete!
[root@redmine01 ~]#
■Passengerのインストール
[root@redmine01 ~]# gem install passenger --no-rdoc --no-ri
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions. This could take a while...
Fetching: daemon_controller-0.2.6.gem (100%)
Fetching: passenger-3.0.9.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-0.2.6
Successfully installed passenger-3.0.9
3 gems installed
[root@redmine01 ~]#
■PassengerのApache用モジュールのインストール
[root@redmine01 ~]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.9.
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++
* Curl development headers with SSL support... found
* OpenSSL development headers... found
* Zlib development headers... found
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /usr/local/bin/rake
* rack... found
* Apache 2... found at /usr/sbin/httpd
* Apache 2 development headers... found at /usr/sbin/apxs
* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
* Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config
--------------------------------------------
Compiling and installing Apache 2 module...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
/usr/local/bin/ruby /usr/local/bin/rake apache2:clean apache2 RELEASE=yes
(中略)
--------------------------------------------
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.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
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
configuration!
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:
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to '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.8/gems/passenger-3.0.9/doc/Users guide Apache.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.
[root@redmine01 ~]#
■Apacheの設定
⇒worker MPMに切り替える
[root@redmine01 ~]# vi /etc/sysconfig/httpd
[root@redmine01 ~]# grep httpd.worker /etc/sysconfig/httpd
#HTTPD=/usr/sbin/httpd.worker
HTTPD=/usr/sbin/httpd.worker ←追記
⇒passnger.conf作成
[root@redmine01 ~]# vi /etc/httpd/conf.d/passnger.conf
[root@redmine01 ~]# cat /etc/httpd/conf.d/passnger.conf
# output of "passenger-install-apache2-module"
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
PassengerRuby /usr/local/bin/ruby
# rails settings
RailsBaseURI /redmine
# Passengerが追加するHTTPヘッダを削除するための設定
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"
# 必要に応じてPassengerのチューニングのための設定を追加。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerUseGlobalQueue on
PassengerHighPerformance on
PassengerStatThrottleRate 10
RailsSpawnMethod smart
RailsAppSpawnerIdleTime 86400
RailsFrameworkSpawnerIdleTime 0
[root@redmine01 ~]#
⇒Apache自動起動設定
[root@redmine01 ~]# chkconfig --list httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@redmine01 ~]# chkconfig httpd on
⇒Redmineディレクトリの所有者変更
[root@redmine01 ~]# chown -R apache: /opt/redmine-1.2.1
⇒サブディレクトリでRedmineを実行(シンボリックリンク作成)
[root@redmine01 ~]# ln -s /opt/redmine-1.2.1/public /var/www/html/redmine
⇒Apacheを起動
[root@redmine01 ~]# /etc/init.d/httpd configtest
Syntax OK
[root@redmine01 ~]# /etc/init.d/httpd graceful
httpd not running, trying to start
[root@redmine01 ~]#
⇒ブラウザからアクセス
http://192.168.1.15/redmine/
ログイン:admin/admin
お手数をおかけして恐縮ですが、広告サイトクリックにご協力いただけるとありがたいです。m(_ _)m
0 件のコメント:
コメントを投稿