"Incomplete response received from application" from nginx / passenger

This error occurs because you didn't set the secret_key_base. Follow these steps to fix it:

Go to your rails app directory

cd /path/rails-app

Generate secret key base

rake secret RAILS_ENV=production

Set environment variable

SECRET_KEY_BASE=<the-secret-key-base>

Restart the Rails app

touch /path/rails-app/tmp/restart.txt

Your rails_env production don't have required set up,probably missing secret_key_base.

Open /etc/nginx/sites-available/default and change the rails_env to development:

rails_env production;
        to
rails_env development;

If the app is loading it's not a passenger issue.

Production Solution:

  1. Enter your app root
  2. run: rake secret
  3. copy the output
  4. go to /yourapp/config/secrets.yml
  5. set the production secret_key_base

Restart the passenger app :

touch /yourapp/tmp/restart.txt