From 324dbe9bec24204bb554b6b816e8921a315c0177 Mon Sep 17 00:00:00 2001 From: pjv Date: Mon, 19 Jan 2015 08:16:55 -0700 Subject: [PATCH 1/2] only cache 200 response code pages to keep fastcgi cache from mistakenly caching (and then serving) 5XX error pages and other things it shouldn't, only cache pages with a 200 response code. --- config/nginx/conf.d/fastcgi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nginx/conf.d/fastcgi.conf b/config/nginx/conf.d/fastcgi.conf index bae48edf6..3c05afa85 100644 --- a/config/nginx/conf.d/fastcgi.conf +++ b/config/nginx/conf.d/fastcgi.conf @@ -3,7 +3,7 @@ fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; -fastcgi_cache_valid any 1h; +fastcgi_cache_valid 200 1h; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; From fc4fcf774dcfa79234f66df9e0c115811577d86e Mon Sep 17 00:00:00 2001 From: pjv Date: Wed, 21 Jan 2015 04:49:39 -0700 Subject: [PATCH 2/2] Add 301, 302, 404 per Rahul http://community.rtcamp.com/t/fascgi-cache-caching-error-pages/3847 --- config/nginx/conf.d/fastcgi.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nginx/conf.d/fastcgi.conf b/config/nginx/conf.d/fastcgi.conf index 3c05afa85..4c51baa45 100644 --- a/config/nginx/conf.d/fastcgi.conf +++ b/config/nginx/conf.d/fastcgi.conf @@ -3,7 +3,7 @@ fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; -fastcgi_cache_valid 200 1h; +fastcgi_cache_valid 200 301 302 404 1h; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k;