cd /usr/ports/www/rubygem-passenger
make
make install
インストール時のメッセージ
Installing rubygem-passenger-apache-5.3.5_1...
#####################################################################
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5
PassengerRuby /usr/local/bin/ruby24
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/2.4/gems/passenger-5.3.5/buildout/apache2/module_libboost_oxt.a(system_calls.o)
/usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5/buildout/common/libboost_oxt.a(system_calls.o)
/usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5/buildout/support-binaries/PassengerAgent
/usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so
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:
http://www.phusionpassenger.com/
うむ、想像はしていましたが、apache のある環境では(?) rubygem-passenger-apache がインストールされるようです。
3. /usr/local/etc/apache24/httpd.conf 編集
/usr/local/etc/apache24/httpd.conf
デフォルトから編集するとすれば
LoadModule alias_module libexec/apache24/mod_alias.so
#LoadModule rewrite_module libexec/apache24/mod_rewrite.so
# Third party modules
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf
の 182行あたりに以下の3行を追加します。
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.4/gems/passenger-5.3.5
PassengerRuby /usr/local/bin/ruby24
次に
/usr/local/etc/apache24/Include/project.conf
てなファイルを作成して、下記のように記述しました。
Alias /project "/プロジェクトパス/public/"
<Directory "/プロジェクトパス/public/">
Options +ExecCGI -Indexes
AllowOverride All
Require all granted
</Directory>
4. apache 再起動
> service apache24 configtest
Performing sanity check on apache24 configuration:
Syntax OK
でエラーがないことを確認して
> service apache24 graceful
http://IPアドレス/project/
にアクセスしましたら・・・。
ブラウザには
Forbidden
You don't have permission to access /project/ on this server.
が表示されるし、ウェブサーバのエラーログには
[Thu Nov 15 12:40:50.864905 2018] [autoindex:error] [pid 671] [client 172.20.10.2:61546] AH01276: Cannot serve directory /usr/local/project/public/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
と出力されております。
そりゃぁそうだわな。
/プロジェクトパス/public/index.html
なんかねぇし。
作った覚えもない。
はて、index.html を置くように書いてあるサイトもありますが・・・。
そもそもここを根本的になんとかするにはどうするかを簡単に説明してくれているサイトがない。
やれ本を読めだのなんだの書いてありますが・・・。
う~ん。
そこでまぁ、見本にしようとこの環境に「Redmine」をいれることを思いつきました。
で、ここでそこへ飛んでしまうのです。
ここから先はいったん「アプリケーション・ツール・ユーティリティ - マルチプラットフォーム」の「Redmine」の項目で作業します(2018年11月15日)。
5. コンフィグレーションファイル再編集
でまぁ、前項の最後でやり始めた「Redmine」のインストールも挫折してしまいましたが、インストール途中に見つけた「Redmine 3.4をUbuntu Server 16.04.2 LTSにインストールする手順 | Redmine.JP Blog」が少しヒントになりました。
/usr/local/etc/apache24/Include/project.conf
を修正します。
Alias /project "/プロジェクトパス/public/"
<Directory "/プロジェクトパス/public/">
Options +ExecCGI -Indexes
AllowOverride All
Require all granted
</Directory>
<Location /project>
PassengerBaseURI /project
PassengerAppRoot /プロジェクトパス
</Location>
上記のように修正しなおして
> service apache24 configtest
Performing sanity check on apache24 configuration:
Syntax OK
> service apache24 graceful
Performing sanity check on apache24 configuration:
Syntax OK
Performing a graceful restart
再起動後に
http://IPアドレス/project/
にアクセスしましたらば、それまで