简体   繁体   中英

Nginx + Phusion Passenger + Rails = staging ENV won't be set

I am having trouble making phusion passenger see that the server is set for staging instead of production.

I have changed /etc/nginx/sites-enabled/<my app>

using sudo nano /etc/nginx/sites-enabled/<my app>

server {
    listen 80;
    server_name <app name>;
    return 301 https://$host$request_uri;
}
server {
  listen 443 ssl;
  server_name <app name>;

  passenger_enabled on;
  passenger_app_env staging;
  rails_env staging;
  root /home/deploy/apps/<app name>/current/public;

  location ~ /.well-known {
    allow all;
  }
}

basically added/changed lines

passenger_app_env staging; rails_env staging;

but still not working, is there anything else i need to do?

For future reference after two hours of searching i found out that

rails_env "staging"; line of code

should be added to /etc/nginx/nginx.conf instead.

Hope that helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM