本页主题: Apache + "Ruby on Rails" on FreeBSD 打印 | 加为IE收藏 | 复制链接 | 收藏主题 | 上一主题 | 下一主题

admin
级别: 管理员


精华: 1
发帖: 4646
威望: 47 点
金钱: 23190 RMB
贡献值: 0 点
注册时间:2006-10-09
最后登录:2008-11-22

 Apache + "Ruby on Rails" on FreeBSD

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
顶端 Posted: 2008-05-13 12:33 | [楼 主]
帖子浏览记录 版块浏览记录
承德互联 » unix专区

Total 0.291165(s) query 5, Time now is:11-22 12:17, Gzip enabled
Powered by PHPWind v6.3.2 Certificate Code © 2003-08 PHPWind.com Corporation