I am running a Rails 4 app on a VPS with Ubuntu, NginX and Unicorn.
When I SSL into my server and update the app via git or run rake tasks on the database, my app always switches to development
mode and I can’t get it into production
mode.
Typing RAILS_ENV=production
seems to have no effect at all.
When I do
$ rails console
$ Rails.env
I get
–> development
all the time.
What must I do to force NginX into production
mode?
Actually, I don’t want Nginx to ever run in development
mode.
How can this be achieved?
Thanks for any help.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi Andrew,
4 years on and I’m still struggling with this issue :-)
This is my upstart (?) script inside /etc/init.d:
As far as I can tell the Rails environment gets set to
production
but I might be wrong.Would be glad if you could have another look.
Thanks!
It’s not nginx that is running in development mode. It’s your application. When you start your application with unicorn_rails, pass -E production to start it in production mode.