aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorBen Walding <ben@walding.com>2011-09-14 15:27:38 +1000
committerBen Walding <ben@walding.com>2011-09-14 15:27:38 +1000
commitb3ff720567b41ca5db9e6956c37cc0792b7a3f4e (patch)
treeeea1b9eafce277289dc2bbc5187724d4e8c87b4d /railties/guides/source
parent681c4dbb0222ac403de8ea0bfcf8ad77c5430585 (diff)
downloadrails-b3ff720567b41ca5db9e6956c37cc0792b7a3f4e.tar.gz
rails-b3ff720567b41ca5db9e6956c37cc0792b7a3f4e.tar.bz2
rails-b3ff720567b41ca5db9e6956c37cc0792b7a3f4e.zip
Add equivalent nginx configuration
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/asset_pipeline.textile16
1 files changed, 15 insertions, 1 deletions
diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile
index 31a1aeee15..ce4eafb97c 100644
--- a/railties/guides/source/asset_pipeline.textile
+++ b/railties/guides/source/asset_pipeline.textile
@@ -403,7 +403,21 @@ For Apache:
</LocationMatch>
</plain>
-TODO: nginx instructions
+For nginx:
+
+<plain>
+location ~ ^/assets/ {
+ expires 1y;
+ add_header Cache-Control public;
+
+ # Some browsers still send conditional-GET requests if there's a
+ # Last-Modified header or an ETag header even if they haven't
+ # reached the expiry date sent in the Expires header.
+ add_header Last-Modified "";
+ add_header ETag "";
+ break;
+}
+</plain>
When files are precompiled, Sprockets also creates a "Gzip":http://en.wikipedia.org/wiki/Gzip (.gz) version of your assets. This avoids the server having to do this for any requests; it can simply read the compressed files from disk. You must configure your server to use gzip compression and serve the compressed assets that will be stored in the +public/assets+ folder. The following configuration options can be used: