Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Incomplete response received from application" from nginx / passenger

I tried to deploy my rails app on nginx and ubuntu via capistrano like the tutorial on the page https://gorails.com/deploy/ubuntu/14.04. but at the end i get an error message:

Incomplete response received from application

in my browser. this is probably an error from passenger, but how can i figure out what to do?

like image 784
juicy Avatar asked Mar 24 '15 19:03

juicy


4 Answers

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
like image 113
Yaniv Vova Alterman Avatar answered Nov 17 '22 22:11

Yaniv Vova Alterman


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
like image 24
Hoa Hoang Avatar answered Nov 17 '22 21:11

Hoa Hoang


I had this problem over the weekend (it turned out there was an incompatibility between my versions of passenger and ruby).

However, nobody seems to be mentioning: the actual error might appear in /var/log/apache2/errors.log, not in any custom log.

Once you know that, hopefully your search will be easier!


Update, since I needed to refer back to this again - this hold true for nginx too - /var/log/nginx/error.log is your friend in that case!

like image 6
user208769 Avatar answered Nov 17 '22 22:11

user208769


For those using Passenger:

• Navigate to root of your project.

• run bundle exec rake secret RAILS_ENV=production

• Copy the output and then run sudo nano config/secrets.yml

• Under production, replace the value of the secret_key_base with the recently copied rake secret.

• press CNTRL+X, then press y, then hit enter.

• run passenger-config restart-app and select the app you wish to restart.

https://www.phusionpassenger.com/library/admin/apache/restart_app.html

like image 5
Ctpelnar1988 Avatar answered Nov 17 '22 20:11

Ctpelnar1988