# Apache with Ruby

**URL:** <https://www.ruby-forum.com/t/apache-with-ruby/56700>\
**Category:** Ruby\
**Created:** [April 3, 2006, 2:57am UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700 "2006-04-03T02:57:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 3, 2006, 2:57am UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/1 "2006-04-03T02:57:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 3, 2006, 3:06am UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/2 "2006-04-03T03:06:12Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 4, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/3 "2006-04-04T22:34:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 4, 2006, 11:42pm UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/4 "2006-04-04T23:42:26Z")

</div>

Just curious David, why choose mod\_fastcgi over mod\_ruby?

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 4, 2006, 11:42pm UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/5 "2006-04-04T23:42:25Z")

</div>

> 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. 🙂

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 5, 2006, 5:44am UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/6 "2006-04-05T05:44:11Z")

</div>

On 05/04/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto: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 🙂

;Daniel

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

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 12, 2006, 6:44pm UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/7 "2006-04-12T18:44:21Z")

</div>

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

-Brian

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [August 3, 2006, 2:21pm UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/8 "2006-08-03T14:21:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Henry\_Ortega](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@Henry\_Ortega](https://www.ruby-forum.com/u/Henry_Ortega)\
**Post date:** [April 9, 2006, 3:41am UTC](https://www.ruby-forum.com/t/apache-with-ruby/56700/9 "2006-04-09T03:41:30Z")

</div>

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.
