Did I setup this correctly?


#1

Hello All, I have been using the tutorials for several years without any issues and I appreciate them greatly. I have decided to switch over from memcache to redis yesterday and all is working well. I just had quick question:

when I curl -I https://pagefrom.my.site the headers always include this:

X-Cache: MISS X-Cache-2: BYPASS

I have confirmed that redis is caching by using redis-cli and redis admin.

My setup is nginx-custom from the rtcamp repos, I am using pagespeed, redis for object caching via the object-store.php and I have followed the nginx tutorial for redis caching with conditional purging.

Previously when I was using fastcgi_cache with nginx instead of redis I would see the headers would include ‘hit’. I am wondering if I screwed something up or it is just a different method? Any help you can provide would be most appreciated!

Paul


#2

Here are the relevant parts of the nginx config for my wordpress site if it helps

`
set $skip_cache 0;

	if ($request_method = POST) {
		set $skip_cache 1;
		}   
	if ($query_string != "") {
		set $skip_cache 1;
	}
	
	if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
		set $skip_cache 1;
	}

	if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
		set $skip_cache 1;
	}   

	location / {
		try_files $uri $uri/ /wordpress/index.php?$args;
	}

	location /redis-fetch {
		internal;
		set $redis_key &args;
		redis_pass 127.0.0.1:6379;
	}

	location /redis-store {
		internal;
		set_unescape_uri $key $arg_key;
		redis2_query  set $key $echo_request_body;
		redis2_query expire $key 14400;
		redis2_pass  127.0.0.1:6379;
	}

	location ~ \.(hh|php) {
		set $key "nginx-cache:$scheme$request_method$host$request_uri";
		try_files $uri =404;
		proxy_intercept_errors on;
		fastcgi_keep_conn on;
		fastcgi_pass php_backend;
		fastcgi_index index.php;
		include fastcgi_params;
		srcache_fetch_skip $skip_cache;
	    srcache_store_skip $skip_cache;
	    srcache_response_cache_control off;
	    set_escape_uri $escaped_key $key;
	    srcache_fetch GET /redis-fetch $key;
	    srcache_store PUT /redis-store key=$escaped_key;
	    more_set_headers 'X-Cache $srcache_fetch_status';
	    more_set_headers 'X-Cache-2 $srcache_store_status';
	} 

	location ~* ^.+\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js|ogg|ogv|svg|svgz|mp4|rss|atom|ico|jpg|jpeg|gif|png|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
			access_log off;	log_not_found off; expires max; add_header Cache-Control public; gzip_vary on;
	}

	location = /robots.txt { access_log off; log_not_found off; }
    location ~ /\. { deny  all; access_log off; log_not_found off; }

`


#3