Welcome Guest | Login

dispatch.fcgi failes to start

Im trying to deploy my first rails app (a blog Ive built myself), but are having some trouble. Ive followed the how to deploy..tutorial, but it wont start up.

When i run ruby dispatch.fcgi, I get lots of this stuff:

undefined method `downcase' for nil:NilClass
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/request.rb:22:in `method'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/routing.rb:1366:in `extract_request_environment'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/routing.rb:1315:in `recognize'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:40:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:168:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:143:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:109:in `with_signal_handler'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:142:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:606:in `each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:141:in `process_each_request!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:55:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:25:in `process!'
dispatch.fcgi:24
and it ends in a 500 server error page.

I guess my .htaccess, enviroment or routes.rb contains the actual problem, but they all seem fine to me. Here they are:

dispatch.fcgi
If i go to my site url, the content of this file is displayed instead of my site

#!/usr/local/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# and the GC period is nil (turned off).  A reasonable number of requests
# could range from 10-100 depending on the memory footprint of your app.
#
# Example:
#   # Default log path, normal GC behavior.
#   RailsFCGIHandler.process!
#
#   # Default log path, 50 requests between GC.
#   RailsFCGIHandler.process! nil, 50
#
#   # Custom log path, normal GC behavior.
#   RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
#
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'

RailsFCGIHandler.process!
-

.htaccess

# General Apache options
# AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"

.

database.yml

production:
 host: localhost
 adapter: mysql
 database: nybobra_nybobrass
 username: nybobra_root
 password: root
 socket: /tmp/mysql.sock
.

routes.rb
Here i only added the third last line, map.connect ''... pointing to my app entry point controller (list of posts in the blog)
ActionController::Routing::Routes.draw do |map|
 # The priority is based upon order of creation: first created -> highest priority.

 # Sample of regular route:
 #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
 # Keep in mind you can assign values other than :controller and :action

 # Sample of named route:
 #   map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
 # This route can be invoked with purchase_url(:id => product.id)

 # Sample resource route (maps HTTP verbs to controller actions automatically):
 #   map.resources :products

 # Sample resource route with options:
 #   map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }

 # Sample resource route with sub-resources:
 #   map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller

 # Sample resource route within a namespace:
 #   map.namespace :admin do |admin|
 #     # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
 #     admin.resources :products
 #   end

 # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
 # map.root :controller => "welcome"

 # See how all your routes lay out with "rake routes"

 map.connect '', :controller => 'post'

 # Install the default routes as the lowest priority.
 map.connect ':controller/:action/:id'
 map.connect ':controller/:action/:id.:format'
end
Ive made sure file permissions are all 755. Enviroment.rb is also configured to be in production mode (which works since the app errors I have aboce goes in the production log file)

Anyone spots what Ive done wrong?

Im a beginner rails developer and this is the first time ive tried to deployment.

2008-02-10 03:21 PM

I couldn't replicate the problem running dispatch.fcgi under yuor account. However if oyu still have this problem, could you try adding "host: localhost" to your ~app/config/database.yml file ?


2008-02-10 04:53 PM

I added host: localhost to my database.yml file, but the problem remains. I get the same NilClass/downcase error in my production.log when i run the file.

Are you sure Ive configured my .htaccess file correctly? This was the only file i was abit puzzled by following the getting started tutorial.

2008-02-11 06:12 AM

Hello,

I tried accessing the following link http://625nyb.bunyan.hostingrails.com/ which is parked on your main domain. It was working fine. Can you confirm whether you are still facing issues at your end.

2008-02-11 06:31 AM

Regards,
Rahul
It works now! Maybe it was the missing host: localhost setting i database.yml. I only tried to run it using ruby dispatch.fcgi, not following the link.

Thanks!

2008-02-11 06:48 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.