【发布时间】:2019-02-11 23:11:27
【问题描述】:
我正在运行 Wordpress + NGINX + PHM-FPM。我已经对我的 NGINX 配置进行了这些更改,这些更改来自我遇到的最佳实践文章:
#Don't cache if there is a cookie called PHPSESSID
if ($http_cookie ~* "PHPSESSID"){
set $no_cache 1;
}
#Don't cache if there is a cookie called wordpress_logged_in_[hash]
if ($http_cookie ~* "wordpress_logged_in_"){
set $no_cache 1;
}
但是,这意味着在使用 PHPSESSID cookie 时请求的帖子页面(我的大部分点击)不会被缓存。帖子页面不包含每个用户的上下文并且是通用的。有没有更好的方法只允许缓存帖子页面?也许使用“domain.com/yyyy/mm/dd/post-name”模式?
【问题讨论】: