use simply static cache to instead fast-cgi cache to boost your wordpress 10x

Simply Static is a static site generator for WordPress that helps you create a static site that you can serve separately from your WordPress installation. This provides a couple benefits. One, this allows you to keep WordPress in a secure location that no one can access but you. Two, your static site is going to be really, really fast.

SECURITY

WordPress is used by one in four websites. That makes it a prime target for hackers. There are a lot of ways that your site can be compromised, but two-thirds of all hacks are caused by vulnerabilities in WordPress plugins, themes, and core files.

Keeping WordPress secure requires constant vigilance. Exploits are being found for WordPress themes and plugins every day. Even WordPress itself has critical vulnerabilities from time to time. If you don’t stay on top of updates, your site will get hacked. It’s just a matter of when.

But what if there was an easy way to keep WordPress secure? What if you could lock WordPress away somewhere where no one can get to it but you?

With Simply Static you can put your WordPress installation in a secure location and publish a static site for the rest of the world to see. You can keep WordPress at a secret URL, protect it with .htaccess, or even put it behind a VPN. Simply Static will create static copies of all of the pages from your WordPress installation and replace the URLs to match where you’ll be hosting it.

PERFORMANCE

Every time you visit a WordPress page it needs to perform database queries to fetch content and run PHP code to render the page. These actions take time to perform.

With Simply Static, you’re creating a static copy of all of your WordPress pages. That time to create each page is incurred once, when Simply Static runs. When someone visits your static site they can instantly receive the page because Simply Static already did the work of creating it.

Depending on the complexity of your site, theme, and plugins, using a static site can easily increase the performance of your site by 10x.

1.Download and install wordpress simply static plugin here:

https://wordpress.org/plugins/simply-static/

2. generate static html in “/static/”    path  under doc_root

Check DEMO:

https://vpseo.com

 

nginx config rewrite:

set $static "/static";
        #post访问不缓存
        if ($request_method = POST) {
            set $static "";
        }   
        #动态查询不缓存
        if ($query_string != "") {
            set $static "";
        }   
        #后台等特定页面不缓存(其他需求请自行添加即可)
        if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
            set $static "";
        }   
        #对登录用户、评论过的用户不展示缓存
      if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
            set $static "";
        }


#try_files $static$uri $static$uri/index.html /index.php;


  location =/ {
  try_files  $uri $static/$uri/  $uri/ /index.php?q=$uri&$args;
  }

  location / {
  try_files  $uri $uri/ $static/$uri/  /index.php?q=$uri&$args;
  }
 
  location /wp-admin/{
  try_files  $uri $uri/ /index.php?q=$uri&$args;
  }

相关推荐

暂无评论

微信扫一扫,分享到朋友圈

use simply static cache to instead fast-cgi cache to boost your wordpress 10x