• 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
What's Hot

如何防止SSH命令中断 XshellPortable、putty、SecureCRT等断网造成Linux命令中断

6月 30, 2023

linux zip分卷压缩解压命令

6月 30, 2023

如何在wordpress中使用Elementor编辑器显示WooCommerce产品SKU

6月 27, 2023
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram
VPSEO VPSEO
  • 首页
    • English
    • 中文
  • 关于我们
  • 服务项目
    • 谷歌SEO服务
    • WordPress建站服务
    • 谷歌ADS/SEM代运营
  • 项目案例
    • 医疗
    • 建材
    • 机械加工
    • 照明
    • 电商
    • 电脑硬件
  • 博客
    • 服务器运维
      • aliyun
      • 服务器安装
      • 宝塔面板
      • 虚拟化
      • 阿里云
      • Centos
      • linux
      • nginx
    • 电子商务
    • 免费资源
    • PHP
      • Magento
      • WordPress
    • 大数据采集
    • Python
    • Javascript
    • SEO
    • 未分类
  • 联系我们
VPSEO VPSEO
Home»nginx»nginx wordpress 反向代理缓存规则
nginx

nginx wordpress 反向代理缓存规则

chrispengcnBy chrispengcn5月 14, 2023没有评论1 Min Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

include /www/server/nginx/conf/wpproxycache.conf;

#============ WordPress 动态页面不缓存 ===========
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;
}

proxy_no_cache $skip_cache;

#缓存清理配置(可选模块,请安装 nginx helper 插件)
location ~ /purge(/.*) {
allow 127.0.0.1;
allow $YOUR_VPS_IP;

deny all;
proxy_cache_purge cache_one "$host$uri$is_args$args";
}


#============ WordPress 动态页面不缓存 ===========

 

proxy_ignore_headers Set-Cookie Cache-Control expires; proxy_cache cache_one; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid 200 304 301 302 120m;

 

 

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
chrispengcn
  • Website

Related Posts

nginx屏蔽中国ip地址以及开放特定ip地址

6月 23, 2022

Nginx 自动识别PC端与Mobile移动端

1月 7, 2022

宝塔面板nginx 安装安全狗过程

10月 20, 2021

Nginx 平台下安装 Modsecurity 并配置规则

10月 20, 2021
Add A Comment

Leave A Reply Cancel Reply

*

code

导航
  • 首页
  • 关于我们
  • 服务项目
  • 项目案例
  • 博客文章
  • 联系我们
博客
  • 服务器运维
  • 服务器安装
  • nginx
  • PHP
  • WordPress
  • Python
  • Javascript
  • SEO
  • 电子商务
  • 大数据采集
  • 宝塔面板
  • 数据库
  • 电子商务
  • 虚拟化
  • 阿里云
导航
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们
最新文章
  • 如何防止SSH命令中断 XshellPortable、putty、SecureCRT等断网造成Linux命令中断
  • linux zip分卷压缩解压命令
  • 如何在wordpress中使用Elementor编辑器显示WooCommerce产品SKU
  • docker下如何部署 varnish ?
  • 包裹激增!中国电商让韩国海关爆仓
关于我们
关于我们

广州纬来科技有限公司
联系地址:广东省广州市番禺区富华中路富源二街18号合和大厦809

QQ : 13602156
Email : [email protected]
Contact: +86 13926026058

Facebook Twitter YouTube LinkedIn
© 2023 广州纬来科技有限公司
  • 首页
  • 关于我们
  • 谷歌SEO服务
  • 谷歌ADS/SEM代运营
  • WordPress建站服务
  • 项目案例
  • 博客
  • 联系我们

Type above and press Enter to search. Press Esc to cancel.