# Problem: Getting Rails to run on apache

**URL:** <https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197>\
**Category:** Ruby\
**Created:** [December 1, 2005, 8:41am UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197 "2005-12-01T08:41:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![newsAT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/278dde/32.png) [@newsAT](https://www.ruby-forum.com/u/newsAT)\
**Post date:** [December 1, 2005, 8:41am UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197/1 "2005-12-01T08:41:52Z")

</div>

hello. I need some help getting rails to run on apache2/red hat. Made  
the correct alias and directory in the .conf, but when I point the  
browser to the directory it gives me a 404 on the dispatch.cgi. I have  
not added fastcgi. i think im missing something basic. possibly  
something in .htaccess

pointers appreciated

---

<div class="post-metadata">

**Author:** ![newsAT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/278dde/32.png) [@newsAT](https://www.ruby-forum.com/u/newsAT)\
**Post date:** [December 1, 2005, 10:10am UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197/2 "2005-12-01T10:10:50Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
one man army [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> hello. I need some help getting rails to run on apache2/red hat. Made  
> the correct alias and directory in the .conf, but when I point the  
> browser to the directory it gives me a 404 on the dispatch.cgi. I have  
> not added fastcgi. i think im missing something basic. possibly  
> something in .htaccess
> 
> pointers appreciated

I got a little further, now the dispatch.cgi is being invoked, but I get  
an internal error 500. ugh.

* * *

Internal Server Error

The server encountered an internal error or misconfiguration and was  
unable to complete your request.

Please contact the server administrator, xxx and inform them of the time  
the error occurred, and anything you might have done that may have  
caused the error.

More information about this error may be available in the server error  
log.  
Apache/2.0.46 (Red Hat) Server at [www.mocana-release.com](http://www.mocana-release.com) Port 80

---

<div class="post-metadata">

**Author:** ![newsAT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/278dde/32.png) [@newsAT](https://www.ruby-forum.com/u/newsAT)\
**Post date:** [December 1, 2005, 2:14pm UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197/3 "2005-12-01T14:14:43Z")

</div>

On Thursday 01 December 2005 03:07, one man army wrote:

> the error occurred, and anything you might have done that may have  
> caused the error.
> 
> More information about this error may be available in the server error  
> log.  
> Apache/2.0.46 (Red Hat) Server at [www.mocana-release.com](http://www.mocana-release.com) Port 80

You’ll find more help and more quickly over at the Rails list:  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Hope you get it fixed though!

---

<div class="post-metadata">

**Author:** ![newsAT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/278dde/32.png) [@newsAT](https://www.ruby-forum.com/u/newsAT)\
**Post date:** [December 2, 2005, 3:34am UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197/4 "2005-12-02T03:34:59Z")

</div>

The oldest problem known to computers… CR-LF vs \n !  
but with httpd.conf and .htaccess throwing constant doubt, it  
was never clear. What an exercise in frustration. The files had come  
from Windows, and got sftp’d to the Linux machine. No one sustpected.  
In anested heirarchy and no suffixes, not that easy to fix, either.

Here are some resources that opened up during the frantic search:

IRC - not, no one jumped in. REALLY hard to read. Shizo in a window…

[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)  
[http://www.ruby-forum.com](http://www.ruby-forum.com)  
[http://wiki.rubyonrails.com/rails/pages](http://wiki.rubyonrails.com/rails/pages)

\<[http://66.102.7.104/search?q=cache:M7NBv8GLChEJ:www.numberporn.com/archi](http://66.102.7.104/search?q=cache:M7NBv8GLChEJ:www.numberporn.com/archi)  
ves/000118.php+htaccess+error+rails&hl=en\>  
[http://httpd.apache.org/docs/1.3/misc/rewriteguide.html](http://httpd.apache.org/docs/1.3/misc/rewriteguide.html)

hth

---

<div class="post-metadata">

**Author:** ![newsAT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/278dde/32.png) [@newsAT](https://www.ruby-forum.com/u/newsAT)\
**Post date:** [December 2, 2005, 5:16pm UTC](https://www.ruby-forum.com/t/problem-getting-rails-to-run-on-apache/49197/5 "2005-12-02T17:16:52Z")

</div>

A little shell lovin’ mixed with Ruby would have seen you through.  
The find command is incredibly powerful, but set aside a day or two  
for digging through the man page. 🙂

$ cd /root/of/cr-lf/nightmare  
$ find . -name ‘\*.conf’ -exec ruby -pi -e ‘sub(/\r\n/,"\n")’ {} ;

That will walk through the tree and exec that ruby bit against every  
file whose name matches \*.conf. Note that you need all the gunk all  
the way to the last semicolon.

Corey
