俺がガンダムだ!
タイトルにはまったく関係なく、今回はとりあえず動く!Passengerの設定。やれって言われたし書きます。
■必要なもの
・Apache2系
・MySQL たぶん4/5系
・使っていいのは刺される覚悟のある奴だけだ、の精神
$ sudo gem install passenger
fastthread必須、未インスコならinstall required dependency fastthread? [YN]とか聞かれるので、Yでインスコする。Nは試合終了お帰りはmongrelです。
$ ruby /usr/local/lib/ruby/gems/1.8/bin/passenger-install-apache2-module
なかったら
$ ruby /usr/lib64/ruby/gems/1.8/gems/passenger-2.0.1/bin/passenger-install-apache2-module
それでもなかったら、
$ find / -name passenger-install* でfindすれ
実行すると、Apache 2... not found とか何があって何が無いのか出てくるから、無いものをパッケージ管理ツールから入れてね
OpenSSL support for Ruby not foundについて
OpenSSL関連のパッケージとrubyのsslライブラリ?とかがないっぽい、以下のコマンドをサルのように実行すればおk。
$ yum install openssl* -> パッケージ管理ツールで入るなら YaST でも aptitude でも apt-get でもなんでもいいんじゃねえ? 無いならソースインスコ $ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.bz2 $ tar jxf ruby-1.8.7-p72.tar.bz2 $ cd ruby-1.8.7-p72/ext/openssl $ ruby extconf.rb $ make # make install -> これでruby-SSLゲトー、Versionは1.8.6とか1.8.7どっちでも大丈夫っぽい。
passenger-install-apache2-module が実行できた場合
The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so RailsSpawnServer /var/lib/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server RailsRuby /usr/bin/ruby1.8 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!
LoadModule/RailsSpawnServer/RailsRubyの3行をコピーしておきます。
なんなら > とかで出力しとくべき。
ちなみに上記の3行は、ミドルウェアのインストール状況で結構異なるので、ここの設定をコピペしても動かないよたぶん。
LoadModule/RailsSpawnServer/RailsRubyの3行を出力できたら
httpd.confに設定を書き込みます。
ちなみにPassengerはVirtualHostに設定を記述していきます。
[httpd.confの最下行あたりに追記] $ sudo vi /etc/httpd/conf/httpd.conf LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so RailsSpawnServer /var/lib/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server RailsRuby /usr/bin/ruby1.8 <VirtualHost *:80> DocumentRoot /var/www/public_rails/ <Directory /> Options FollowSymLinks AllowOverride None Allow from all </Directory> </VirtualHost> ->注意:Allow from allを忘れると、public以下が全滅した希ガス
ちなみに、RailsRubyの下あたりに「RAILS_ENV」って書くと、動作モードを指定できる、デフォでproductionだけど。
あとはいつものようにapache起動すれば、80番だろうが65536番だろうが、ポートが塞がってない限り利用可能。
$ sudo /etc/init.d/httpd start