# Apache2 on red hat linux need help anyone

**URL:** <https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330>\
**Category:** Rails\
**Created:** [June 24, 2006, 11:38am UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330 "2006-06-24T11:38:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 24, 2006, 11:38am UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/1 "2006-06-24T11:38:34Z")

</div>

I’ve poured over many docs online and thought it would be wonderful to  
get RoR running in 15 minutes. Well after 15 hours, I’m completely  
stuck and ready to give up on RoR. I’m hoping somebody can give me  
some guidance. I’ve pulled out my hair and am bald like others who  
have tried to get RoR running without any luck.

When I run [http://71.159.224.53/say/hello](http://71.159.224.53/say/hello), I keep get application error:

Change this error message for exceptions thrown outside of an action  
(like in Dispatcher setups or broken Ruby code) in public/500.html

I’m trying to get RoR running on Apache2 on Red Hat Enterprise 4. By  
the way if Apache2 is no good with RoR, I can switch to Apache 1.3. In  
any case, I have the standard set up as you can see at the very bottom  
of this post.

The interesting thing is that I output the rewrite.log and it shows  
that for some reason RoR is trying to access:

/var/www/rails/demo/public/say/hello.html/hello → say/hello.html/hello

And it fails when it doesn’t find this file:

/var/www/rails/demo/public/say/hello.html’ pattern=‘!-f’ =\> matched

However, my “say” controller is located here:

/var/www/rails/demo/app/controllers/say\_controller.rb

## Here is the output of the rewrite log. Something is not write here:

68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (2) init rewrite  
engine with requested uri /say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (1) pass through  
/say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] add path info postfix:  
/var/www/rails/demo/public/say → /var/www/rails/demo/public/say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] strip per-dir prefix:  
/var/www/rails/demo/public/say/hello → say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] applying pattern ‘^$’ to uri ‘say/hello’  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] add path info postfix:  
/var/www/rails/demo/public/say → /var/www/rails/demo/public/say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] strip per-dir prefix:  
/var/www/rails/demo/public/say/hello → say/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] applying pattern ‘^([^.]+)$’ to uri  
‘say/hello’  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (2) [per-dir  
/var/www/rails/demo/public/] rewrite say/hello → say/hello.html  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] add per-dir prefix: say/hello.html →   
/var/www/rails/demo/public/say/hello.html  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] add path info postfix:  
/var/www/rails/demo/public/say/hello.html →   
/var/www/rails/demo/public/say/hello.html/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] strip per-dir prefix:  
/var/www/rails/demo/public/say/hello.html/hello → say/hello.html/hello  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (3) [per-dir  
/var/www/rails/demo/public/] applying pattern ‘^(.\*)$’ to uri  
‘say/hello.html/hello’  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (4) RewriteCond:  
input=‘/var/www/rails/demo/public/say/hello.html’ pattern=‘!-f’ =\>  
matched  
68.111.180.250 - - [24/Jun/2006:02:22:29 --0700]  
[71.159.224.53/sid#81d3230][rid#81e2a98/initial] (2)…

----------------- APACHE2 CONF VIRTUAL HOST --------------------------  
NameVirtualHost 71.159.224.53

\<VirtualHost 71.159.224.53\>  
ServerAdmin removed\_email\_address@domain.invalid  
DocumentRoot /var/www/rails/demo/public  
#ServerName [www.example.com](http://www.example.com)  
ErrorLog /var/log/httpd/rail-error\_log  
CustomLog /var/log/httpd/rail-access\_log common

# Options Indexes ExecCGI FollowSymLinks

```
 RewriteEngine On
 RewriteLog "/var/log/httpd/rewrite.log"
 RewriteLogLevel 4

```

------------------------ .htaccess --------------------------------

# General Apache options

AddHandler fastcgi-script .fcgi  
AddHandler cgi-script .cgi  
Options +FollowSymLinks +ExecCGI

RewriteEngine On  
RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(.\*)$ dispatch.cgi [QSA,L]

–  
removed\_email\_address@domain.invalid  
Position Research, Inc.  
Search engine results by research  
tel: (760) 480-8291 fax: (760) 480-8271  
[www.PositionResearch.com](http://www.PositionResearch.com)

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 24, 2006, 6:07pm UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/2 "2006-06-24T18:07:45Z")

</div>

First things first:

Change the last line of your .htaccess to dispatch.fcgi. Right now it’s  
going to use dispatch.cgi wich defeats the purpose of having fcgi  
installed for faster performance.

I don’t have an immediate answer for your stated problem though. Sorry.

Gil Vidals wrote:

> ------------------------ .htaccess --------------------------------
> 
> # General Apache options
> 
> AddHandler fastcgi-script .fcgi  
> AddHandler cgi-script .cgi  
> Options +FollowSymLinks +ExecCGI
> 
> RewriteEngine On  
> RewriteRule ^$ index.html [QSA]  
> RewriteRule ^([^.]+)$ $1.html [QSA]  
> RewriteCond %{REQUEST\_FILENAME} !-f  
> RewriteRule ^(.\*)$ dispatch.cgi [QSA,L]
> 
> –  
> removed\_email\_address@domain.invalid  
> Position Research, Inc.  
> Search engine results by research  
> tel: (760) 480-8291 fax: (760) 480-8271  
> [www.PositionResearch.com](http://www.PositionResearch.com)

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 24, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/3 "2006-06-24T20:56:34Z")

</div>

I struggled mightily with Apache2/FastCGI on RHEL3 when I first began  
deploying RoR apps. It always … sort of worked. Things got really  
hairy when I tried integrating ImageMagick/RMagick. Finally I switched  
to Lighttpd to serve the app and proxy through Apache. It’s far less  
painful - I recommend this route. Also, your dev environment will be  
closer to your production enevironment, which is handy.

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 25, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/4 "2006-06-25T16:27:49Z")

</div>

+1 for Lighty. The configuration takes like 5 simple lines.

However, if you have simple needs, Mongrel would do a good job of  
serving your app.

Did you just recently start with Rails? If so, you really shouldn’t even  
be worrying about a production server like Apache yet. Stick with  
WEBrick until you really have something that needs a faster server.

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 27, 2006, 12:33am UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/5 "2006-06-27T00:33:57Z")

</div>

Thank you for your help! Will RoR play well with Apache 1.3 in the  
RHEL world? I’d hat to develop a great RoR app and then when it  
finally needs speak, fail on the Apache installation! That would make  
me sick.

You mentioned proxying through Apache. I’m very curious about this.  
Can you elaborate a little. What was the purpose of proxying through  
Apache? Wasn’t Lighttpd enough??

Gil

–  
removed\_email\_address@domain.invalid  
Position Research, Inc.  
Search engine results by research  
tel: (760) 480-8291 fax: (760) 480-8271  
[www.PositionResearch.com](http://www.PositionResearch.com)

Quoting Lance D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 27, 2006, 1:53am UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/6 "2006-06-27T01:53:31Z")

</div>

Yeah, “Lighty” is the easy way to say “Lighttpd” conversationally.  
Seriously, ever try to say it out loud?

Apache 1.3 is just aging. It’s more difficult to use RoR’s routing  
system with Apache for some reason. I’ve never dug that far into it  
because I light Lighty so much. WAY simpler syntax for everything in my  
opinion.

---

<div class="post-metadata">

**Author:** ![Gil\_Vidals](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ccd318/32.png) [@Gil\_Vidals](https://www.ruby-forum.com/u/Gil_Vidals)\
**Post date:** [June 27, 2006, 12:34am UTC](https://www.ruby-forum.com/t/apache2-on-red-hat-linux-need-help-anyone/64330/7 "2006-06-27T00:34:12Z")

</div>

By Lighty, do you mean Lighttpd? I’m completely new to RoR and to all  
these new web servers. I’m use to using Apache 1.3 and it seems that  
RoR doesn’t work well with Apache, which seems odd to me as Apache is  
the industry standard.

Gil

–  
removed\_email\_address@domain.invalid  
Position Research, Inc.  
Search engine results by research  
tel: (760) 480-8291 fax: (760) 480-8271  
[www.PositionResearch.com](http://www.PositionResearch.com)

Quoting Bryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
