# Rails on plesk+apache2+fcgid

**URL:** <https://www.ruby-forum.com/t/rails-on-plesk-apache2-fcgid/69286>\
**Category:** Rails\
**Created:** [September 20, 2006, 12:00am UTC](https://www.ruby-forum.com/t/rails-on-plesk-apache2-fcgid/69286 "2006-09-20T00:00:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wintermute](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e19b73/32.png) [@wintermute](https://www.ruby-forum.com/u/wintermute)\
**Post date:** [September 20, 2006, 12:00am UTC](https://www.ruby-forum.com/t/rails-on-plesk-apache2-fcgid/69286/1 "2006-09-20T00:00:26Z")

</div>

Hi,

I am try to get RoR running with ruby 1.8.4, Rails 1.1.6, mod\_fcgid  
1.09, Apache 2, on CentOS 4.3.

When I browser to [http://www.mydomain.com/test/](http://www.mydomain.com/test/) (definately with end  
slash) I get an application error. In the apache.log it says that  
dispatch.fcgi has ended prematurely, and in the development.log I get:

#-------------------- development.log

Recognition failed for “”^M  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/routing.rb:522:in  
`recognition_failed'^M /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:512:in `recognize!‘^M  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in  
`dispatch'^M /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:in `process\_request’^M  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi\_handler.rb:54:in  
`process!'^M /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:606:in `each\_cgi’^M  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi\_handler.rb:53:in  
`process!'^M /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in `process!'^M  
public/dispatch.fcgi:24

dispatch.fcgi has the corrent path to ruby. And it seems to be running  
but it is not getting the “test” directive.

Any ideas? Thanks for your time.  
David

Other files

#--------------- vhost.conf

SetEnv RAILS\_ENV development  
DocumentRoot /var/www/rails/app/public/  
ErrorLog /var/www/rails/app/log/apache.log

\<Directory /var/www/rails/app/public/\>  
Options ExecCGI FollowSymLinks  
AddHandler fcgid-script .fcgi  
AllowOverride all  
Order allow,deny  
Allow from all

#------------- uncommented lines in .htaccess

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”

# ---- END

---

<div class="post-metadata">

**Author:** ![wintermute](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e19b73/32.png) [@wintermute](https://www.ruby-forum.com/u/wintermute)\
**Post date:** [September 20, 2006, 11:24pm UTC](https://www.ruby-forum.com/t/rails-on-plesk-apache2-fcgid/69286/2 "2006-09-20T23:24:05Z")

</div>

hello

i am using the same exact setup for one of my rails app ([sprinj.com](http://sprinj.com))  
about the fcgi ending prematurely, i added these lines in dispatch.fcgi

require ‘fcgi\_handler’  
class RailsFCGIHandler  
private  
def frao\_handler(signal)  
dispatcher\_log :info, “asked to terminate immediately”  
dispatcher\_log :info, “frao handler will be restarted”  
restart\_handler(signal)  
end  
alias\_method :exit\_now\_handler, :frao\_handler  
end  
RailsFCGIHandler.process!

now whenever it stops, it restarts automatically.

also i dont know why you have SetEnv RAILS\_ENV development in  
vhost.conf,  
shouldn t that be in environement.rb?

–  
Heri R.  
[http://sprinj.com](http://sprinj.com)

---

<div class="post-metadata">

**Author:** ![wintermute](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e19b73/32.png) [@wintermute](https://www.ruby-forum.com/u/wintermute)\
**Post date:** [September 21, 2006, 4:05am UTC](https://www.ruby-forum.com/t/rails-on-plesk-apache2-fcgid/69286/3 "2006-09-21T04:05:20Z")

</div>

Thanks Heri,

I think the recognition error is causing the script to end early. Do you  
have any ideas on the recognition error.

Cheers, D
