基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)

作者 : administrator 本文共2344个字,预计阅读时间需要6分钟 发布时间: 2023-12-13 共460人阅读

1.安装redis
过程不再赘述。

2.安装php的redis和opcache扩展

基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
3.安装wordpress的Redis Object Cache和WP Super Cache缓存插件

基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
4.设置缓存插件
(1)WP Super Cache
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
按照图示进行设置即可:
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站

设置完成后点击更新保存设置。
接下来配置预缓存:
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
检查是否生效:
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
有内容则缓存成功:(没有内容也不用着急,继续往下做)
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站

值得注意的是:一定要开启专家模式而不是普通模式,经测试,普通模式会与接下来要配置的redis插件冲突!

(2)Redis Object Cache
打开开关即可:
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站

过一段时间有图像则缓存成功:
基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)-手游资源站

5.修改站点伪静态

  1. # WP Super Cache rules.
  2. # Designed to be included from a ‘wordpress-ms-…’ configuration file.
  3. set $cache_uri $request_uri;
  4. # 请求方式为post时不使用缓存
  5. if ($request_method = POST) {
  6.         set $cache_uri ‘null cache’;
  7. }
  8. if ($query_string != “”) {
  9.         set $cache_uri ‘null cache’;
  10. }
  11. # uri包含以下内容时不使用缓存
  12. 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)”) {
  13.         set $cache_uri ‘null cache’;
  14. }
  15. # 对登录用户或已发布评论用户不使用缓存
  16. if ($http_cookie ~* “comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in”) {
  17.         set $cache_uri ‘null cache’;
  18. }
  19. # START MOBILE
  20. # 如果需要在移动端禁用缓存,可以把代码前的#删掉
  21. # if ($http_x_wap_profile) {
  22. #        set $cache_uri ‘null cache’;
  23. #}
  24. #if ($http_profile) {
  25. #        set $cache_uri ‘null cache’;
  26. #}
  27. #if ($http_user_agent ~* (2.0\ MMP|240×320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800)) {
  28. #       set $cache_uri ‘null cache’;
  29. #}
  30. #if ($http_user_agent ~* (w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-)) {
  31.   #      set $cache_uri ‘null cache’;
  32. #}
  33. #END MOBILE
  34. # 如果存在缓存,则使用缓存,如果没有缓存,直接转向动态页面
  35. location /
  36. {
  37.      try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args ;
  38. }
  39. rewrite /wp-admin$ $scheme://$host$uri/ permanent;

复制代码

配置完成后,再去WP Super Cache重新生成缓存,这样就没问题了!

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 下载资源请24小时内删除 运营请支持正版 请合法合规运营
2.不建议充值下载-请大家每天签到或发布资源获取下载,请大家一点要摆正自己的思想关 坚决杜绝 知法犯法
3.如果贵公司发现本站有侵权行为,请来联系我们给予指正,本站将即刻删除链接.分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务 请大家谅解!

手游资源站 » 基于Redis Object Cache和WP Super Cache的wordpress缓存方案(速度优化)

92 评论

  1. Pingback: tadalafil
  2. Pingback: cialis slogan
  3. Pingback: cialis low dose
  4. Pingback: generic viagra us
  5. Pingback: kaiser valtrex
  6. Pingback: metformin oxygen
  7. Pingback: lisinopril 5034
  8. Pingback: flagyl deafness
  9. Pingback: keflex antibiotics
  10. Pingback: porn
  11. Pingback: porno izle
  12. Pingback: child porn
  13. Pingback: porn
  14. Pingback: porno izle
  15. Pingback: effexor xr dosage
  16. Pingback: diclofenac wiki
  17. Pingback: flomax and herbs
  18. Pingback: diltiazem 120 mg
  19. Pingback: is buspar an ssri
  20. Pingback: celebrex ibuprofen
  21. Pingback: abilify vs latuda
  22. Pingback: remeron reviews
  23. Pingback: acarbose australia
  24. Pingback: 1800baddrug actos
  25. Pingback: synthroid drooling
  26. Pingback: tizanidine 6 mg

发表回复