aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: