看了下张戈的这篇文章https://zhangge.net/5042.html关于nging Fastcgi_cache缓存的配置 请问各位大佬nging Fastcgi_cache的缓存插件怎么缓存不同页面的缓存时间设置不一样? 我自己location ~ /info/([0-9]+)/$缓存这个伪静态的规则,好像缓存不起作用,还是只匹配缓存下面的location ~ [^/]\.php(/|$)的缓存时间#Fastcgi_cache缓存开始 # 跳过缓存开关,1为跳过缓存,0为不跳过缓存set $skip_cache 0; #post访问不缓存,if ($request_method = POST) { set $skip_cache 1;} #动态查询不缓存if ($query_string != “”) { set $skip_cache 1;} #后台等特定页面不缓存(其他需求请自行添加即可) if ($request_uri ~* “/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.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;}#缓存伪静态book开头的所有页面/好像没用location ~ /info/([0-9]+)/${ try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi-73.sock; fastcgi_index index.php; include enable-php-73.conf; #缓存规则 fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; add_header X-Cache “$upstream_cache_status From $host”; #注意!cgi_one的缓存名,keys_zone=cgi_one叫什么,这里就填什么名。 fastcgi_cache cgi_one; fastcgi_cache_valid 200 301 302 60s; fastcgi_cache_valid 404 500 502 503 504 0s; fastcgi_cache_valid any 0s;}location ~ [^/]\.php(/|$){ try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi-73.sock; fastcgi_index index.php; include enable-php-73.conf; #缓存规则 fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; add_header X-Cache “$upstream_cache_status From $host”; #注意!cgi_one的缓存名,keys_zone=cgi_one叫什么,这里就填什么名。 fastcgi_cache cgi_one; fastcgi_cache_valid 200 301 302 1d; fastcgi_cache_valid 404 500 502 503 504 0s; fastcgi_cache_valid any 0s;}复制代码