Rails 生产服务器未显示对视图的更改

Rails production server not showing changes to views

我在 ec2 实例上托管一个 Rails 4 应用程序并使用 Nginx,我向控制器添加了一个视图,但在尝试通过浏览器导航到该页面时遇到错误,直到我重新加载 nginx.conf。一旦出现,我对视图进行了一些更改,但在我再次重新加载 nginx.conf 之前,这些更改都没有显示。

显然我不想每次需要更改视图时都重新加载 nginx.conf。我是否遗漏了一些让自己更轻松的东西?

这是我的 nginx.conf 文件。

server {
    listen       80;
    server_name  app-on-rails;
    passenger_enabled on;
    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    root   /home/usr/www/app-on-rails/welcome;
    index index.html.erb;
}

我的 environments/production.rb 文件

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_files = false
  config.assets.js_compressor = :uglifier
  config.assets.compile = true

您的 nginx 配置似乎正在使用 passenger。默认情况下,在生产模式下,所有文件内容都会被解析一次,并缓存在内存中——因此不会立即注意到更改。要强制刷新,您至少需要重新启动 passenger。这可以通过简单地触摸应用程序根目录中的 tmp/restart.txt 文件来完成。