Rails生产服务器不显示视图更改

时间:2015-09-30 21:56:02

标签: ruby-on-rails ruby-on-rails-4 nginx production-environment

我在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;
}

我的环境/ 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

1 个答案:

答案 0 :(得分:1)

Your nginx config appears to be using passenger. By default, in production mode all file content is parsed once, and cached in memory - so changes will not be immediately noticeable. To force a refresh, you need to at a minimum restart passenger. This can be done by simply touching the tmp/restart.txt file in your application root directory.