【问题标题】:caching static files for ruby on rails application using nginx使用 nginx 为 ruby​​ on rails 应用程序缓存静态文件
【发布时间】:2011-02-03 17:30:36
【问题描述】:

一段时间以来,我一直在尝试使用 nginx 为我的 rails 应用程序提供和缓存静态文件。 rails 应用服务器运行 mongrel_cluster 并部署在与 nginx 不同的主机上。

在许多可用的讨论之后,我尝试了以下

server {

     listen       80;

     server_name  www.myappserver.com;



     ssl on;

     root /var/apps/myapp/current/public;



     location ~ ^/(images|javascripts|stylesheets)/ {

            root /var/apps/myapp/current;

            expires 10y;

                                                    }



     location / {

                    proxy_pass http://myapp_upstream;

                }

                  }

但 nginx 无法找到图像并加载 css 和 js 文件。有谁能帮帮我吗?

我的目标是配置 nginx,使其缓存静态文件直到过期。

请建议我一些方法来实现这一点,还是我在这里遗漏了任何一点?

【问题讨论】:

    标签: ruby-on-rails caching nginx static-files


    【解决方案1】:

    你好。我相信以斯拉在这里@Engine Yard 几年前写过一篇博文。所有这些都是开箱即用的@EY,所以这是利用他的专业知识的一种方式。 :-)

    【讨论】:

      猜你喜欢
      • 2015-02-28
      • 2017-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-23
      • 2017-03-08
      • 2011-01-08
      相关资源
      最近更新 更多