# Ruby + Apache, scripts not being interpreted

**URL:** <https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129>\
**Category:** Ruby\
**Created:** [October 13, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129 "2007-10-13T12:10:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 13, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129/1 "2007-10-13T12:10:40Z")

</div>

I am trying to get Ruby running on Apache. I may or may not have a  
problem. What do you think?

I have a test site called ruby-test set up with a vhost. When I go to  
rails-test/ I see the “Welcome Aboard” page. But when I click the  
“About your application’s environment” link the script doesnt get  
interpreted … I just see it as text. I havent gone any further than  
this, as I have been trying to get that script to run.

rails-test/public/.htaccess looks like:

AddHandler fcgid-script .fcgi  
Options +FollowSymLinks +ExecCGI  
RewriteEngine On  
RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.fcgi [QSA,L]  
ErrorDocument 500 “

## Application error
Rails application failed  
to start properly”

The vhost .conf for the site looks like:

\<VirtualHost \*:80\>  
DocumentRoot “/var/www/webroot/rails-test/public”  
ServerName rails-test  
\<Directory “/var/www/webroot/rails-test/public”\>  
Options ExecCGI FollowSymLinks  
AllowOverride all  
Order allow,deny  
Allow from all

Is the problem that the .rb file that the link points to is in a  
directory that doesnt have +ExecCGI set? What must I do to fix this?  
Am quite stuck.

I guess one solution is to get mod\_ruby working right? But I cant  
figure out how to check if it is working already, or find a set of  
instructions how to install it.

Help greatly appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 22, 2007, 7:05pm UTC](https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129/2 "2007-10-22T19:05:41Z")

</div>

On Oct 13, 11:07 am, nobrow [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> The vhost .conf for the site looks like:
> 
> Is the problem that the .rb file that the link points to is in a  
> directory that doesnt have +ExecCGI set? What must I do to fix this?  
> Am quite stuck.
> 
> I guess one solution is to get mod\_ruby working right? But I cant  
> figure out how to check if it is working already, or find a set of  
> instructions how to install it.
> 
> Help greatly appreciated, thanks.

Bump

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 23, 2007, 1:49am UTC](https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129/3 "2007-10-23T01:49:06Z")

</div>

On Oct 22, 2007, at 12:05 PM, nobrow wrote:

> > rails-test/public/.htaccess looks like:
> > 
> > ```
> > </Directory>
> > 
> > ```
> > 
> > Help greatly appreciated, thanks.
> 
> Bump

Rails Talk will be your best source of an answer for this.

---

<div class="post-metadata">

**Author:** ![nobrow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/edb3f5/32.png) [@nobrow](https://www.ruby-forum.com/u/nobrow)\
**Post date:** [October 23, 2007, 2:13am UTC](https://www.ruby-forum.com/t/ruby-apache-scripts-not-being-interpreted/117129/4 "2007-10-23T02:13:03Z")

</div>

nobrow wrote:

> I am trying to get Ruby running on Apache. I may or may not have a  
> problem. What do you think?
> 
> I have a test site called ruby-test set up with a vhost. When I go to  
> rails-test/ I see the “Welcome Aboard” page. But when I click the  
> “About your application’s environment” link the script doesnt get  
> interpreted … I just see it as text. I havent gone any further than  
> this, as I have been trying to get that script to run.

You also may have to tell apache that files ending in .rb are to be  
handled via cgi. Otherwise, it really is just text.

AddHandler cgi-script .rb

Check the archives for threads on Ruby + CGI

–  
James B.

“The greatest obstacle to discovery is not ignorance, but the illusion  
of knowledge.”

- D. Boorstin
