【发布时间】:2013-09-20 11:29:35
【问题描述】:
如何配置 NGINX 以提供从 RAILS_ROOT/public/uploads 上传的载波文件? 例如:http://deckbuilder.justnetwork.eu//uploads/card/image/173/54.png
当 config.serve_static_assets = true 时,文件得到服务,但这很慢。我希望 NGINX 为他们服务。 CS、JS 和图片正在被提供。
这是我的 NGINX 配置的摘录:
root /var/www/hsdeckbuilder/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://localhost:8101;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
}
【问题讨论】:
-
将上传文件放在单独的目录(公共目录之外)并告诉 ngnix 从那里为它们提供服务怎么样?
标签: ruby-on-rails ruby ruby-on-rails-3 nginx asset-pipeline