1

This is my first time deploying a Rails app to a production server, I have already done almost everything. I'm stuck with the process to make the app run in production mode, I already typed

 $ export RAILS_ENV=production

and

 $ echo $RAILS_ENV

and the terminal throws that I am in the production mode, but when I go to a url in my app not yet defined by me, the server is still debugging the templates, I just want the server throws the default 404 page.

Be patient to me I'm new in this. :)

user3754535
  • 131
  • 11

1 Answers1

1

You need to change the rails_env setting in nginx/conf/nginx.conf, as follows:

server {
    listen             <port_number>;
    passenger_enabled  on;
    root               /home/<username>/webapps/<app_name>/<app>/public;
    server_name        localhost;
    rails_env          production;
}

If you do this and are greeted with a "502 Bad Gateway" error for your efforts, the issue may be that you don't have the SECRET_KEY_BASE environment variable set. You can generate a suitable value with rake secret, and then add export SECRET_KEY_BASE="<secret>" wherever you're setting other environment variables.

Webfaction's Rails deployment documentation has improved substantially, but this is one of a number of non-intuitive steps it still skips over.

Siobhán
  • 1,451
  • 10
  • 9