Mod_ruby and Rails configuration files

I walked through Curt Hibbs' tutorial
(http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=1) for
Ruby on Rails and was very impressed. So far though, I've only gotten
my Rails web site running through WEBrick. I'd like to get it running
through Apache. I have mod_ruby installed, and Apache's configuration
files now get Apache to correctly handle *.rhtml pages through eRuby.
But I haven't been able to figure out the Apache configuration to get
my Rails cookbook/recipe app to run from within Apache.

Below is the configuration section relevant to the discussion. Can
anyone please tell me what I am doing wrong, and how I can get Rails
running through Apache? (I believe I'm running the latest ruby and
rails available--from Gentoo Portage)

Thanks in advance. Configuration follows.

LoadModule ruby_module ../apache2-extramodules/mod_ruby.so

# Ruby scripts (.rbx) support
<IfModule mod_ruby.c>
  RubyRequire apache/ruby-run

  # Execute *.rbx files as Ruby scripts
  <Files *.rbx>
    SetHandler ruby-object
    RubyHandler Apache::RubyRun.instance
  </Files>
</IfModule>

# eRuby (.rhtml) support
<IfModule mod_ruby.c>
  RubyRequire apache/eruby-run

  # Handle *.rhtml files as eRuby files
  <Files *.rhtml>
    SetHandler ruby-object
    RubyHandler Apache::ERubyRun.instance
  </Files>
</IfModule>

Alias /cookbook "/home/ala55/rails/cookbook/public"
<Directory /home/ala55/rails/cookbook/public>
  Order allow,deny
  Allow from all

  Options ExecCGI
  SetHandler ruby-object
  RubyHandler Apache::RubyRun.instance
</Directory>

I'm not expert at Apache + Rails, but I've seen enough of the docs to point
you in the right direction possibly. Have you tried the following?

http://wiki.rubyonrails.com/rails/search/?query=apache

Hope this helps

Tobin

"Andrew Arnott" <andrewarnott@gmail.com> wrote in message
news:1115177581.832307.169020@f14g2000cwb.googlegroups.com...

···

I walked through Curt Hibbs' tutorial
(Radar – O’Reilly) for
Ruby on Rails and was very impressed. So far though, I've only gotten
my Rails web site running through WEBrick. I'd like to get it running
through Apache. I have mod_ruby installed, and Apache's configuration
files now get Apache to correctly handle *.rhtml pages through eRuby.
But I haven't been able to figure out the Apache configuration to get
my Rails cookbook/recipe app to run from within Apache.

Below is the configuration section relevant to the discussion. Can
anyone please tell me what I am doing wrong, and how I can get Rails
running through Apache? (I believe I'm running the latest ruby and
rails available--from Gentoo Portage)

Thanks in advance. Configuration follows.

LoadModule ruby_module ../apache2-extramodules/mod_ruby.so

# Ruby scripts (.rbx) support
<IfModule mod_ruby.c>
RubyRequire apache/ruby-run

# Execute *.rbx files as Ruby scripts
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
</IfModule>

# eRuby (.rhtml) support
<IfModule mod_ruby.c>
RubyRequire apache/eruby-run

# Handle *.rhtml files as eRuby files
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>

Alias /cookbook "/home/ala55/rails/cookbook/public"
<Directory /home/ala55/rails/cookbook/public>
Order allow,deny
Allow from all

Options ExecCGI
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Directory>

Below is the configuration section relevant to the discussion. Can
anyone please tell me what I am doing wrong, and how I can get Rails
running through Apache? (I believe I'm running the latest ruby and
rails available--from Gentoo Portage)

You don't want to use mod_ruby. FastCGI is where its at. There's an example Apache configuration in the README file and there's a resource page for FastCGI on http://wiki.rubyonrails.com/rails/show/FastCGI

···

--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com -- Online project management
http://www.rubyonrails.com -- Web-application framework

I'm following the directions on
http://wiki.rubyonrails.com/rails/show/HowtoInstallOnGentooWithApache,
which I found with Tobin's help. I'm shooting for FastCGI now, as a
result of David's recommendation.

I've following the installation instructions (I think), but I keep
getting the error below when I pull up
http://127.0.0.1/ala55/cookbook/recipe/list. I have a symlink set up,
and Options ExecCGI FollowSymLinks set also. I can navigate in the
file system to the very file Apache claims not to be able to find.
Permissions are 755 on all files in the public directory. Any ideas?

Not Found

The requested URL /home/ala55/public_html/cookbook/dispatch.fcgi was
not found on this server.
Apache/2.0.52 (Gentoo/Linux) mod_fastcgi/2.4.2 PHP/4.3.11
mod_mono/1.0.6.99 mod_ruby/1.2.4 Ruby/1.8.2(2004-12-25) Server at
fhssdev2.byu.edu Port 80