2014年4月4日金曜日

Redmine on TS-220 (4) Passenger のインストールと Apache 連携

既存の Apache Http Server を利用し Passenger をインストールするため
少々まわりくどいことをします。

■ httpd 2.2.26 のインストール

 既存のままでは Passenger のコンパイルが通らないことから
 足りない部分を補います。

current directory: /opt/local/src

httpd の取得
# wget http://archive.apache.org/dist/httpd/httpd-2.2.26.tar.gz
# tar xvfz httpd-2.2.26.tar.gz

apr のインストール
# cd httpd-2.2.26/srclib/apr
# ./configure --prefix=/opt/local/httpd-2.2.26-apr
# make
# make check
# make install
# cd ../apr-util

apr-util のインストール
# ./configure --prefix=/opt/local/httpd-2.2.26-apr-util --with-apr=/opt/local/httpd-2.2.26-apr
# make
# make check
# make install
# cd ../..

httpd のインストール
# ./configure --prefix=/opt/local/httpd-2.2.26 --with-apr=/opt/local/httpd-2.2.26-apr --with-apr-util=/opt/local/httpd-2.2.26-apr-util
# make
# make check
# make install
# cd ..


■ Passenger 3.0.0 のインストール

# gem install passenger --version 3.0.0

apxs の編集
# vi /usr/local/apache/bin/apxs

apxs 内の Perl の位置を変更
#!/opt/bin/perl -w

apxs 内の installbuilddir の位置を変更
my $installbuilddir = "/opt/local/httpd-2.2.26/build";

環境変数の設定
# export APXS2=/usr/local/apache/bin/apxs
# export PATH=/usr/local/apache/bin:$PATH

Passenger のコンパイル
# /opt/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/bin/passenger-install-apache2-module


■ Passenger の設定

 Apache との連携を行うため、Passenger の設定ファイルを作成します。

passenger-3.0.0.conf の作成と編集
# touch /usr/local/apache/conf/extra/passenger-3.0.0.conf
# vi /usr/local/apache/conf/extra/passenger-3.0.0.conf

(a) redmine ディレクトリを Apache 権限にする(passenger-3.0.0.conf)
LoadModule passenger_module /opt/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0
PassengerRuby /opt/local/ruby-1.9.2-p320/bin/ruby
RackBaseURI /redmine

# chown -R httpdusr:administrators /opt/local/redmine-2.4.3

(b) redmine ディレクトリを admin 権限にする(passenger-3.0.0.conf)
LoadModule passenger_module /opt/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.0
PassengerRuby /opt/local/ruby-1.9.2-p320/bin/ruby
RackBaseURI /redmine
PassengerDefaultUser admin
PassengerDefaultGroup administrators
PassengerAnalyticsLogUser admin

(a) と (b) はお好みで。
※ 今回の動作確認は (a) で行っています。


■ Apache の設定

apache.conf の編集
# vi /usr/local/apache/conf/apache.conf

Passenger の設定をインクルード(apache.conf)
Include /etc/config/apache/extra/passenger-3.0.0.conf

※ファイル下方に追記します。


■ ドキュメントルートの設定

# ln -s /opt/local/redmine-2.4.3/public /share/Web/redmine


■ Apache の再起動

# /etc/init.d/Qthttpd.sh restart


■ Redmine へのアクセス

 再起動後、ブラウザから http://'NAS-IP'/redmine へアクセスし、Redmine の画面が表示されていることを確認。


お疲れ様でした。

0 件のコメント :

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。