# Mod\_ruby, eRuby Question

**URL:** <https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018>\
**Category:** Ruby\
**Created:** [January 23, 2007, 12:55am UTC](https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018 "2007-01-23T00:55:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lincoln\_Anderson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@Lincoln\_Anderson](https://www.ruby-forum.com/u/Lincoln_Anderson)\
**Post date:** [January 23, 2007, 12:55am UTC](https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018/1 "2007-01-23T00:55:22Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

I’ve got an Apache2 testbed server set up to do some work with Ruby and  
RoR… As part of the setup I installed mod\_ruby so that Apache can  
process Ruby scripts, as well as eRuby so that I can embed Ruby in html  
files. I’m not exactly sure which module is doing this, so I mention  
both of them, but here’s the behavior I’m seeing…

Under /var/www I have three directories, ./cgi-bin, ./eruby, ./ruby.  
There are currently no files in either ./cgi-bin or ./ruby. In ./eruby,  
there is a single .rhtml file, which just has a simple \<%print “Hello  
World”%\> in the body. If I load the page explicitly  
([http://www.heyblinkin.net/eruby/index.rhtml](http://www.heyblinkin.net/eruby/index.rhtml)), I see the expected  
result, “Hello World”. If, however, I enter [www.heyblinkin.net/eruby](http://www.heyblinkin.net/eruby), I  
am met with 500 Internal Server Error.

Inspecting the error.log for apache shows Ruby errors, stating that Ruby  
attempted to evaluate a directory. This explains the error, however,  
once I implemented a fix that I thought should work, namely, adding  
index.rhtml to the list of files that DirectoryIndex takes, I still get  
this error.

To complicate matters, I have apache set up so that users get  
public\_html directories with corresponding ./cgi-bin and ./eruby  
directories. I have a similar index.rhtml file in my  
~/public\_html/eruby directory, and loading  
[www.heyblinkin.net/~user\_name/eruby/](http://www.heyblinkin.net/~user_name/eruby/) gives the expected result, namely,  
“Hello World”. It opens the index.rhtml file that I added to the  
DirectoryIndex field and does not complain.

Is there something else I need to add to my /var/www/eruby directory?  
It’s not a major problem, but it is a little annoying. Any help is  
appreciated.

Lincoln Anderson  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.6 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iD8DBQFFtU7QR8wmeqHdtdcRArQbAKDCr+YjQ5o+yYi/nJdgEqmqCkvEqgCgqBH3  
uTvbdmMXfSmHQWbyMwgzKxw=  
=Xusg  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Lincoln\_Anderson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@Lincoln\_Anderson](https://www.ruby-forum.com/u/Lincoln_Anderson)\
**Post date:** [January 30, 2007, 3:33pm UTC](https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018/2 "2007-01-30T15:33:26Z")

</div>

I’m losing my mind as well on this setup. eRuby is working fine for me  
and I can run .rhtml files but I can’t get my server to handle .rb or  
.rbx files using mod\_ruby.

I get the same 500 error.

People always marvel at the cute little RoR videos but when it comes  
time to get into production almost no one has done it. Basecamp is the  
only example that I know of.

WTF!?

Anyway, if someone can chime in, I would much appreciate it.

---

<div class="post-metadata">

**Author:** ![Lincoln\_Anderson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@Lincoln\_Anderson](https://www.ruby-forum.com/u/Lincoln_Anderson)\
**Post date:** [January 30, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018/3 "2007-01-30T19:05:31Z")

</div>

On Jan 30, 9:33 am, Thomas B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> WTF!?
> 
> Anyway, if someone can chime in, I would much appreciate it.
> 
> –  
> Posted viahttp://www.ruby-forum.com/.

Not to worry. I had this very problem. You need to open your Apache/  
httpd.conf file and add the type as shown below.

Try just adding one type first.

# hdml

AddType text/x-hdml .hdml

AddType application/x-httpd-eruby .rhtml  
Action application/x-httpd-eruby /cgi-bin/eruby

AddHandler cgi-script .cgi .sh .pl .asp .rb .erb

Hope this helps

---

<div class="post-metadata">

**Author:** ![Lincoln\_Anderson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e79b87/32.png) [@Lincoln\_Anderson](https://www.ruby-forum.com/u/Lincoln_Anderson)\
**Post date:** [September 25, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/mod-ruby-eruby-question/83018/4 "2007-09-25T23:04:13Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

joep wrote:

> > only example that I know of.  
> > Not to worry. I had this very problem. You need to open your Apache/  
> > AddHandler cgi-script .cgi .sh .pl .asp .rb .erb
> 
> Hope this helps

I’m pretty sure I added .rhtml types, though I may not have added  
handlers… I’ll check later. If this works and solves the 500s when  
trying to access the /eruby directory I’ll be very grateful. Like I  
said earlier, it’s not that big a deal, just kind of odd that it should  
fail in that particular manner.

Lincoln Anderson  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.6 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iD8DBQFFv3dKR8wmeqHdtdcRAsidAJ9/Lq0vVprutDvfZXRCBfAJzVqoIgCfafKW  
FVvHNrli04bBuLpZ7Yj2kNM=  
=nvyV  
-----END PGP SIGNATURE-----
