Apache with Ruby


#1

I am really new to Ruby. I have just installed Ruby on my Linux box and
it
works fine. I need Apache to recognize Ruby scripts and interpret them.
Is
mod_ruby the only way to do it?


#2

On Apr 2, 2006, at 8:54 PM, Henry Ortega wrote:

I am really new to Ruby. I have just installed Ruby on my Linux box
and it
works fine. I need Apache to recognize Ruby scripts and interpret
them. Is
mod_ruby the only way to do it?

You can of course use the regular CGI methods. I.e. start your files
with
#!/path/to/ruby
… script …

And configure apache to recognize them as cgis (makr them as
executable, put them in cgi-bin or use httpd.conf or .htaccess to
configure apache to recognize .rb files as cgis)


#3

DÅ?a Pondelok 03 Apríl 2006 03:03 Logan C. napísal:

… script …

And configure apache to recognize them as cgis (makr them as
executable, put them in cgi-bin or use httpd.conf or .htaccess to
configure apache to recognize .rb files as cgis)

I’d use mod_fastcgi instead of mod_ruby if you want to avoid the CGI
overhead.

David V.


#4

Just curious David, why choose mod_fastcgi over mod_ruby?


#5

I’d use mod_fastcgi instead of mod_ruby if you want to avoid the
CGI overhead.

Maybe you mis-worded that. Of course, the whole point of using
mod_ruby is to avoid the overhead of using plain old CGI. :slight_smile:


#6

On 05/04/06, removed_email_address@domain.invalid removed_email_address@domain.invalid wrote:

Just curious David, why choose mod_fastcgi over mod_ruby?

afaik:

mod_ruby lives in every instance of the server – so if you have five
apache
processes serving ruby stuff, and five processes serving static content,
you
have the ruby interpreter loaded into memory ten times over.

fast cgi gives you the benefit of a long running ruby interpreter (ie
unlike
normal cgi, where the ruby interp has to start up fresh for every
request),
but still keeps ruby out of the apache footprint, so the Apache process
that
is serving your fav_icon doesn’t pay the ruby memory tax.

that’s my impression at least – but I have been humbled in these forums
before, and probably will be again :slight_smile:

;Daniel


Daniel B.
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things
That Suck)
[[My webhost uptime is ~ 92%… if no answer pls call again later!]]


#7

I suggest considering mod_fcgid ( http://fastcgi.coremail.cn/ ) for
fastcgi in apache 2.0/2.2. It is maintained and works very well.

-Brian


#8

Whoops. Sorry – I see what you were saying now.


#9

DÅ?a Utorok 4. Apríl 2006 23:38 removed_email_address@domain.invalid napísal:

Just curious David, why choose mod_fastcgi over mod_ruby?

For a very anecdotal argument, I also think I recall someone mentioning
mod_ruby using worker threads also causes frameworks that aren’t
threadsafe
(I think Rails is one) to break down in tears.

David V.