From b3ff720567b41ca5db9e6956c37cc0792b7a3f4e Mon Sep 17 00:00:00 2001
From: Ben Walding <ben@walding.com>
Date: Wed, 14 Sep 2011 15:27:38 +1000
Subject: Add equivalent nginx configuration

---
 railties/guides/source/asset_pipeline.textile | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'railties/guides/source/asset_pipeline.textile')

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:
 
-- 
cgit v1.2.3

