- aarwwefdds2013-04-12金牌会员22590
单手摘月 我在rtcamp看到的你的Trackback。才发现你玩的原来是和我一样的东西
不过 FCGI_CACHE 你们有木有遇到 fastcgi_cache_bypass失效的情况
咱配置大概是这样的:- fastcgi_cache_path /dev/shm/nginx-cache levels=1:2 keys_zone=WORDPRESS:500m inactive=60m;- fastcgi_cache_key "$scheme$request_method$host$request_uri";
- fastcgi_cache_use_stale error timeout invalid_header http_500;复制代码...- set $skip_cache 0;
- #set $cache_uri $request_uri;
- if ($request_method = POST) {
- #set $cache_uri 'null cache';
- set $skip_cache 1;
- }
- if ($query_string != "") {
- #set $cache_uri 'null cache';
- 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 $cache_uri 'null cache';
- set $skip_cache 1;
- }
- # Don't use the cache for logged in users or recent commenters
- if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in|w3tc_logged_out|wptouch_switch_toggle") {
- #set $cache_uri 'null cache';
- set $skip_cache 1;
- }
- location ~ /purge(/.*) {
- fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1";
- }
- location / {
- try_files $uri $uri/ /index.php?$args;
- }
- 复制代码...- location ~ .*\.(php|php5)?$
- {
- #try_files $uri =404;
- try_files $uri /index.php;
- include fcgi.conf;
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_cache_valid 60m;
- fastcgi_cache_bypass $skip_cache;
- fastcgi_no_cache $skip_cache;
- fastcgi_cache WORDPRESS;
- }复制代码但是。。。已登录用户虽然不会生成缓存 但是未登录用户访问并生成缓存以后 已登录用户还是去访问缓存去了。。折腾了我好几天了都。。实在搞不清楚到底啥情况。。NginX用过1.0.15 1.2.8 1.3.2 都不行。。