全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1853|回复: 6

博客安装WP-Super-Cache 那么久,发现一直没有真正用静态缓存

[复制链接]
发表于 2021-4-29 22:02:48 | 显示全部楼层 |阅读模式
用了几年WP-Super-Cache
nginx没有改伪静态重写
每次访问访问的其实还是动态,

刚才才改了
  1. # WP Super Cache rules.
  2. # Designed to be included from a 'wordpress-ms-...' configuration file.

  3. set $cache_uri $request_uri;

  4. # POST requests and urls with a query string should always go to PHP
  5. if ($request_method = POST) {
  6.         set $cache_uri 'null cache';
  7. }

  8. if ($query_string != "") {
  9.         set $cache_uri 'null cache';
  10. }   

  11. # Don't cache uris containing the following segments
  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. # Don't use the cache for logged in users or recent commenters
  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. # Mobile browsers section to server them non-cached version. COMMENTED by default as most modern wordpress themes including twenty-eleven are responsive. Uncomment config lines in this section if you want to use a plugin like WP-Touch
  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|240x320|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. # Use cached or actual file if they exists, otherwise pass request to WordPress
  35. location / {
  36.         try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?$args ;
  37. }
复制代码
发表于 2021-4-29 22:04:04 | 显示全部楼层
我想问一下
http://demo.wpcom.cn/justnews

类似这个站,查看源代码,他是怎么做到代码压缩的,不懂
发表于 2021-4-29 22:05:06 | 显示全部楼层

小尾巴翘起来
发表于 2021-4-29 22:06:18 来自手机 | 显示全部楼层
mha 发表于 2021-4-29 22:04
我想问一下
http://demo.wpcom.cn/justnews


没看错的话,这是那个火箭缓存插件(具体叫啥忘记了),自带的代码压缩
发表于 2021-4-29 22:06:31 | 显示全部楼层
NGIX是大佬用的,我这种菜鸡还是用apache更合适一些,毕竟简单

访问量低于百万级别的时候,其实感觉不到差距。
发表于 2021-4-29 22:08:40 来自手机 | 显示全部楼层
mha 发表于 2021-4-29 22:04
我想问一下
http://demo.wpcom.cn/justnews


WP Rocket
 楼主| 发表于 2021-4-29 23:01:23 | 显示全部楼层

原来就是不一般
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-3-29 22:13 , Processed in 0.068079 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表