Mac OS X で Passenger(mod_rails)
とりあえず、Windows 2008 と Vista のVMがメモリを大量に食うので(笑、経費節減。メモリがやすいったって、これ以上(=現在Max 8GB, 内訳、Hyper-V 1GB, 2008 AD(+IIS) 2GB, Vista 2GB, あと3GBしかないよ!) うちのサーバーには乗らないんだもの。
以下ログ。
MacPorts で Apache 2.2 を prefork で導入。
$ sudo ports install apache2 +preforkmpm
で、次にpassengerのgemをいれる。
$ sudo gem install passenger
apache2 の モジュールを入れる。
$ sudo passenger-install-apache2-module
こんな感じで最後に、構成方法を教えてくれる。
Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server RailsRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
<VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /somewhere/public </VirtualHost>
LoadModule のほうは、/etc/apache2/httpd.conf の fastcgi の直後に追加。
#LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server RailsRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
VirtualHost は、/etc/apache2/httpd.conf にある次のコメント行のコメントをはずして、
# Virtual hosts #Include /private/etc/apache2/extra/httpd-vhosts.conf Include /private/etc/apache2/extra/httpd-vhosts.conf
/etc/apache2/extra/httpd-vhosts.conf に次のようにRAILS_ROOTのpublicを指すように。
<VirtualHost *:80> ServerName localhost DocumentRoot /Users/yssk22/webjourney/public RailsEnv development </VirtualHost>
で、apache を起動。
$ sudo apachectl start
で、うちのアプリだとエラーになるので(笑、これからデバッグしていきますTT;