Reputation: 335
I have created new environment "staging". Locally it works. I run it this way:
RAILS_ENV=staging passenger start
On server I use Nginx + passenger. In virtual host settings I have written:
server {
listen 443;
server_name test.myapp.com;
rails_env staging;
root /home/admin/myapp/current/public; # <-- be sure to point to 'public'
passenger_enabled on;
ssl on;
ssl_certificate /home/admin/ssl/server.crt;
ssl_certificate_key /home/admin/ssl/server.key;
}
server {
listen 80;
server_name test.myapp.com;
root /home/admin/myapp/current/public;
rewrite ^ https://$server_name$request_uri? permanent;
}
But app still runs in production. It loads production database, not staging. Reloading Nginx doesn't help. What is wrong?
Upvotes: 3
Views: 1636
Reputation: 7995
Does the .bashrc or .zshrc for the user contain the RAILS_ENV setting? If so, it may be overriding the NGINX setting.
Upvotes: 0
Reputation: 18835
i think you are missing the rails_env
setting.
server {
...
rails_env staging;
}
Upvotes: 4