RailsPlayground
Troubleshoot Common Rails Deployment and Setup issues

The following are the most common reasons why your application may not be running in our environment using FastCGI. If you’re already using Passenger for your application, please ignore the steps involving FCGI and the dispatch.fcgi file.

  1. Verify that your /public directory has the permissions of 755
  2. Verify that your /public/dispatch.fcgi file has the permissions of 755
  3. Verify that your .htaccess file within the public folder has permissions of 644
  4. Verify the shebang line (first line) of the dispatch.fcgi is set to #!/usr/local/bin/ruby . DO NOT USE #!/user/bin/env ruby . This causes the incorrect ruby instance to start the dispatcher and unlike the regular dispatcher processes, these processes do not die when idle and are stagnant on the server, wasting the server’s main memory. They’re also not killed when running “pkill -9 dispatch.fcgi”. So, always make sure you’re using #!/usr/local/bin/ruby as the shebang line.
  5. Verify that you have the correct database name and database password in your config/database.yml
  6. Verify that you have enabled production mode in your environment.rb file by un-commenting this line: ENV['RAILS_ENV'] ||= 'production'
  1. Verify that the RAILS_GEM_VERSION in the environment.rb is set to a version of Rails that is installed on your server.
  2. Verify that any needed gems for your application are installed, if your server is missing a gem, simply email support and they will install the gem for you.
  3. Verify that you are not using any puts statements in your code as this causes problems with Apache.
  4. Try changing to your /public directory and run ./dispatch.fcgi and see if it returns any coding errors with your environment. (actually best to run REQUEST_METHOD=GET ./dispatch.fcgi as this will simulate a browser request)
  5. Check your /log/production.log or development.log for any coding error messages.
  6. Check if your /log/production.log have permissions that allow apache to write to the log file.
  7. If displaying the contents of dispatch.fcgi
    change AddHandler fastcgi-script .fcgi to AddHandler fcgid-script .fcgi
    in .htaccess
    Please Also see: How To use FastCGI and How To Use Rails at RailsPlayground
  8. If your Rails application runs on Rails 2.3.2 or above, you’ll need to use Passenger to serve the application, as FCGI doesn’t work well with these versions. Please read up on Enabling Passenger here: How To use Phusion Passenger