我创造了新的环境“舞台”。在本地它有效。我这样运行它:
RAILS_ENV=staging passenger start
在服务器上,我使用 Nginx + 乘客。在我写的虚拟主机设置中:
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;
}
但应用程序仍在生产中运行。它加载生产数据库,而不是暂存。重新加载 Nginx 没有帮助。怎么了?