Closed dchun closed 9 years ago
@dchun: I think the best way is not push images in app/assets. We need to push all images to public folder and configure nginx serve assets file directly.
@phuong3030 but aren't the current images in the assets folder? Do you mean instead of adding new images to github and deploy we just push up to public folder after deploy?
@dchun: No, I mean we push our assets directly to public folder when we develop application.
When the application is run in production mode, rails application will not serve any static resource and nginx will do this job.
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
try_files $uri 404;
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
I also want to implement Page Caching, Action Caching so we can gain a lot of benefits. What's your opinion?
@phuong it seems that newly added assets to the assets/images/ directory isn't being served by the app in production. I can find the file in the server in two locations. One in the typical path and another in the shared path with a concatenated name of what I think is the release number. I think it might have something to do with the nginx configuration file needing to extend it's search under the try directive. What do you think?