facebook twitter hatena line email

「Ruby/rails/passenger」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(httpd.conf)
(httpd.conf)
行37: 行37:
 
   ServerName example1.server1
 
   ServerName example1.server1
 
   DocumentRoot "/var/www/rails/example1/public"
 
   DocumentRoot "/var/www/rails/example1/public"
   #RailsEnv production
+
   RailsEnv production
  RailsEnv development
+
 
   <Directory "/var/www/rails/example1/public">
 
   <Directory "/var/www/rails/example1/public">
 
     AllowOverride all
 
     AllowOverride all
行45: 行44:
 
   </Directory>
 
   </Directory>
 
</VirtualHost>
 
</VirtualHost>
 +
 +
<VirtualHost *:80>
 +
  ServerName example1-test.server1
 +
  DocumentRoot "/var/www/rails/example1-test/public"
 +
  RailsEnv development
 +
  <Directory "/var/www/rails/example1-test/public">
 +
    AllowOverride all
 +
    Require all granted
 +
    Options -MultiViews
 +
  </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
 
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>
 
<IfModule mod_passenger.c>

2022年9月21日 (水) 21:48時点における版

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"
  RailsEnv production
  <Directory "/var/www/rails/example1/public">
    AllowOverride all
    Require all granted
    Options -MultiViews
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerName example1-test.server1
  DocumentRoot "/var/www/rails/example1-test/public"
  RailsEnv development
  <Directory "/var/www/rails/example1-test/public">
    AllowOverride all
    Require all granted
    Options -MultiViews
  </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>