「Ruby/rails/passenger」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→passengerのapacheモジュールインストール時のエラー) |
(→apache設定) |
||
(同じ利用者による、間の10版が非表示) | |||
行15: | 行15: | ||
c++: コンパイラ内部エラー: 強制終了 (プログラム cc1plus) | c++: コンパイラ内部エラー: 強制終了 (プログラム cc1plus) | ||
Please submit a full bug report, | 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 | ||
</pre> | </pre> | ||
− | + | メモリが足らないので以下対応する | |
+ | <pre> | ||
+ | $ gem install passenger | ||
+ | $ sudo dd if=/dev/zero of=/tmp/swap.img bs=1M count=1024 | ||
+ | $ sudo chmod 600 /tmp/swap.img | ||
+ | $ sudo mkswap /tmp/swap.img | ||
+ | $ sudo swapon /tmp/swap.img | ||
+ | $ passenger-install-apache2-module | ||
+ | </pre> | ||
+ | |||
+ | 参考:https://qiita.com/zhao-xy/items/1846a68e0c788167e0cd | ||
+ | |||
+ | 参考:https://qiita.com/abetd/items/43a06e7376ad7bedca6d | ||
+ | |||
参考:https://donbulinux.hatenablog.jp/entry/2016/07/08/214659 | 参考:https://donbulinux.hatenablog.jp/entry/2016/07/08/214659 | ||
− | ==httpd.conf | + | ==apache設定== |
+ | /etc/httpd/conf/httpd.conf | ||
+ | |||
+ | 適当な場所に追加 | ||
+ | <pre> | ||
+ | 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> | ||
+ | |||
+ | Include conf/extra/example.conf | ||
+ | </pre> | ||
+ | |||
+ | /etc/httpd/conf/extra/example.conf | ||
<pre> | <pre> | ||
<VirtualHost *:80> | <VirtualHost *:80> | ||
ServerName example1.server1 | ServerName example1.server1 | ||
DocumentRoot "/var/www/rails/example1/public" | DocumentRoot "/var/www/rails/example1/public" | ||
− | + | RailsEnv production | |
<Directory "/var/www/rails/example1/public"> | <Directory "/var/www/rails/example1/public"> | ||
AllowOverride all | AllowOverride all | ||
Require all granted | 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> | </Directory> | ||
</VirtualHost> | </VirtualHost> | ||
</pre> | </pre> |
2022年9月22日 (木) 22:18時点における最新版
目次
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=/tmp/swap.img bs=1M count=1024 $ sudo chmod 600 /tmp/swap.img $ sudo mkswap /tmp/swap.img $ sudo swapon /tmp/swap.img $ passenger-install-apache2-module
参考:https://qiita.com/zhao-xy/items/1846a68e0c788167e0cd
参考:https://qiita.com/abetd/items/43a06e7376ad7bedca6d
参考:https://donbulinux.hatenablog.jp/entry/2016/07/08/214659
apache設定
/etc/httpd/conf/httpd.conf
適当な場所に追加
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> Include conf/extra/example.conf
/etc/httpd/conf/extra/example.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>