如何configurationNGINX提供从RAILS_ROOT / public / uploads上传的carrierwave文件? 例如: http : //deckbuilder.justnetwork.eu//uploads/card/image/173/54.png
当config.serve_static_assets = true时,这些文件得到了处理,但是速度很慢。 我希望NGINX为他们服务。 CS,JS和图像正在服务。
这里是我的NGINXconfiguration摘录:
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; }
尝试添加此配置:
location ~ ^/uploads/ { root /var/www/hsdeckbuilder/public; expires 24h; # or whatever you want to use add_header Cache-Control public; break; }
我想我们在我们的服务器上使用这样的东西。