Memo
mod_ruby or fastcgi: http://www.ruby-forum.com/topic/57084#44202
from some articles, mod_ruby seems to be slower(?), anyway, FastCGI is fast enough
getting start for Ruby on Rails: Rolling with Ruby on Rails
Install Procedure
Ruby is executed through CGI, FastCGI will get much faster response.
install apache2
I got problems when running FastCGI on apache13. There is no error message in httpd-error.log and RAILS/log/*/*, while the page displays “Application error Rails application failed to start properly”. I'm sure that the same setting works with CGI.
install FastCGI
# cd /usr/ports/www/mod_fastcgi/
# make install clean
install the language Ruby
# cd /usr/ports/lang/ruby18
# make install clean
install Ruby on Rails (this will also install language ruby)
# cd /usr/ports/www/rubygem-rails
# make install clean
(use root to run the following command, otherwise it won't work)
# gem update
# gem install rails
setup apache, /usr/local/etc/apache2/Include/ruby_on_rails.conf:
LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
<Directory "/usr/local/www/data/rails">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride all
Order allow,deny
Allow from all
</Directory>
AllowOverride → rails need .htaccess to run CGI or FastCGI
build rail repository
# cd /usr/local/www/data/
# rails rails
web pages are placed on http://document_root/rails/public/
force rails to use FastCGI, rails use CGI in default. edit RAILS/public/.htaccess: uncomment this line:
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
and comment this line:
#RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
remember to place the RewriteRule to the last line, otherwise we can't read CSS file
Notes
if there is something wrong, see RAILS/log/*
RAILS/tmp, /tmp/* must be writable by www daemon
Reference
http://www.rubyonrails.org/down
http://wiki.rubyonrails.com/rails/pages/GettingStartedWithRails
http://www.infused.org/2005/03/19/ruby-on-rails-apache-fastcgi-and-ensim/
http://www.twbb.org/viewthread.php?tid=17093
http://www.pighouse.net/~fcamel/Wiki/doku.php?id=system:apache_ruby_on_rails