1. 概要
「Redmine」は、単独でなく、「Apache」と連動させようとしているのですが、どうも大変ぽいなぁ。
前回は、ここまでたどり着いてもいなかったけどね。
2. インストール
ここまでの手順では、「Passenger」は、インストールされていないようです。
探してみると。
cd /usr/ports
make quicksearch name=passenger
すると。
Port: rubygem-passenger-apache-6.0.20
Path: /usr/ports/www/rubygem-passenger
Info: Modules for running Ruby on Rails and Rack applications
Port: rubygem-passenger-nginx-6.0.20
Path: /usr/ports/www/rubygem-passenger
Info: Modules for running Ruby on Rails and Rack applications
「Apache」と「Nginx」が同じパッケージなの?
オプションで分けるのかと思いきや、オプションには、そんな選択肢はありませんでした。
「make」「make install」時のログで見ると、既存のモジュールで判断しているように思われます。
そういえば、「Pyhon」や「Ruby」のモジュールは、本体に合わせて、バージョン番号も変わりますね。
では、「make」します。
cd /usr/ports/www/rubygem-passenger
make
make install
インストール時のメッセージをメモしておきます。
===> Installing for rubygem-passenger-apache-6.0.20
===> Checking if rubygem-passenger-apache is already installed
===> Registering installation for rubygem-passenger-apache-6.0.20
Installing rubygem-passenger-apache-6.0.20...
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/lib/ruby/gems/3.1/gems/passenger/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/3.1/gems/passenger
PassengerRuby /usr/local/bin/ruby31
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!
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/apache2/module_libboost_oxt.a(system_calls.o)
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/common/libboost_oxt.a(system_calls.o)
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/apache2/mod_passenger.so
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/support-binaries/PassengerAgent
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/apache2/module_libboost_oxt/oxt/system_calls.o
/usr/local/lib/ruby/gems/3.1/gems/passenger-6.0.20/buildout/common/libboost_oxt/oxt/system_calls.o
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
https://www.phusionpassenger.com/
3. サイト設定
「Apache」のコンフィグレーションファイルを作成します。
「root」ユーザ権限で。
(ファイル名は、なんでもよい)
vi /usr/local/etc/apache24/Includes/redmine.conf
下記のように記述します。
Listen 3000
LoadModule passenger_module /usr/local/lib/ruby/gems/3.1/gems/passenger/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/3.1/gems/passenger
PassengerRuby /usr/local/bin/ruby31
<VirtualHost *:3000>
ServerName ドメイン名
DocumentRoot /usr/local/www/redmine/public/
<Directory "/usr/local/www/redmine/public/">
Options Indexes ExecCGI FollowSymLinks
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
ドキュメントルートにしたいけど、現行のドキュメントルートがあるので、ポート振り分けで、ここをドキュメントルートにしています。
3~4行は、「Passenger」インストール時に、言われるがままですな。
実際の運用では、証明書関係を定義して、セキュリティ的にもっと厳しくしますが・・・。
service apache24 configtest
service apache24 restart
して。
http://ドメイン名:3000/
へアクセスすると。