facebook twitter hatena line email

Ruby/rails/passenger

提供: 初心者エンジニアの簡易メモ
2022年9月21日 (水) 20:41時点におけるAdmin (トーク | 投稿記録)による版 (httpd.conf)

移動: 案内検索

passengerインストール

$ gem install passenger

passengerのapacheモジュールのインストール準備

$ sudo yum install httpd-devel
$ sudo yum install apr-devel
$ sudo yum install apr-util-devel

passengerのapacheモジュールインストール

$ passenger-install-apache2-module

passengerのapacheモジュールインストール時のエラー

エラー詳細

c++: コンパイラ内部エラー: 強制終了 (プログラム cc1plus)
Please submit a full bug report,
Your compiler failed with the exit status 4. This probably means that it ran out of memory. To solve this problem, try increasing your swap space: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

メモリが足らないので以下対応する

$ gem install passenger
$ sudo dd if=/dev/zero of=/swap bs=1M count=1024
$ sudo mkswap /swap
$ sudo swapon /swap
$ passenger-install-apache2-module

参考:https://qiita.com/zhao-xy/items/1846a68e0c788167e0cd

参考:https://donbulinux.hatenablog.jp/entry/2016/07/08/214659

httpd.conf

<VirtualHost *:80>
  ServerName example1.server1
  DocumentRoot "/var/www/rails/example1/public"
  RackEnv production
  <Directory "/var/www/rails/example1/public">
    AllowOverride all
    Require all granted
  </Directory>
</VirtualHost>
   LoadModule passenger_module /home/user1/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/passenger-6.0.15/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /home/user1/.rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/passenger-6.0.15
     PassengerDefaultRuby /home/user1/.rbenv/versions/2.7.6/bin/ruby
   </IfModule>