Seeing a Ruby On Rails app on a Browser

April 28, 2015 540 views
Ruby on Rails Nginx

I am running a VPS on Centos6.6. I removed Apache and installed Nginx, plus Ruby and Rails and Passenger. Created a sample Hello_World and followed directions from a couple of sites. But when I go to my Browser and point to the site I get an "Incomplete response received from the application" message

1 Answer

This error frequently occurs when your application's secret key base is not set and you attempt to run it in production mode. If you're are still just in the testing and development phase, the quickest way to resolve the issue is to set passenger_app_env in your Nginx configuration to development mode:

server {
    listen 80 default_server;
    passenger_enabled on;
    passenger_app_env development;
    root /home/rails/app/public;

When running in production, you'll want to make sure that the secret key base is correctly configured. First, make sure your config/secrets.yml file contains:

  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

Next, generate a secret key base by running the command rake secret in your Rails project. Now export that value as the SECRET_KEY_BASE environmental variable.

For more info, check out:

by O.S Tezer
In this DigitalOcean article, we are going to show you -- from start to finish -- how to have a rock solid Rails application deployment (i.e. published online) using the latest available CentOS operating system renowned for its stability. This will be alongside Phusion Passenger application server, known for its simplicity and excellent features, coupled with Nginx HTTP server running in front to handle and manage connections.
Have another answer? Share your knowledge.