• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WBXPress.NET

Website Developement Guide

  • apache2
  • nginx
  • mysql
  • php7
  • SSL
  • wordpress
  • genesis
  • caching
  • seo

WordPress Simple caching with Nginx try_files

Updated on 1st March 2019 Leave a Comment

Earlier we used to cache our wordpress sites using PHP-FPM technology. We have a tutorial for this: FastCGI Caching with Nginx on VPS for WordPress

Now, we cache our sites in a simpler and better method. We use a wordpress plugin named Simple Cache. And we shall order Nginx server to serve the cached content bypassing the database query and PHP. Here are the steps:

Step 1. Install and Activate the plugin Simple Cache.

Step 2: Add the following into wp-config.php if the plugin can’t do it for you.

define('WP_CACHE', TRUE);

Step 3: Edit virtual host file. e.g.

sudo nano /etc/nginx/sites-available/wbxpress.conf

Replace the following line inside location / block:

try_files $uri $uri/ /index.php?$args;

By

try_files "wp-content/cache/simple-cache/${http_host}${request_uri}index.html" $uri $uri/ /index.php?$args;

Restart nginx server using the command.

sudo service nginx restart;

Step 4: Now turn on the caching.

Turn On Caching

That’s it. Now you have a fast loading site.

before caching
after caching

Filed Under: nginx, wordpress Tagged With: caching

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Most Popular Posts

  • Remove/ Defer Render-blocking JavaScripts
  • Customizing Genesis eleven40-pro Theme
  • Free Genesis Child Theme by WBXPress
  • Host Multiple Sites with SSL in Ubuntu 18.04
  • 25 Ways to Boost Website Traffic that Really Work

Recent Comments

  • Ruhul on Customizing Genesis eleven40-pro Theme
  • Priya Agarwal on Customizing Genesis eleven40-pro Theme
  • mimi roy on Remove/ Defer Render-blocking JavaScripts
  • danish choudhary on Customizing Genesis eleven40-pro Theme
  • Radhe on Customizing Genesis eleven40-pro Theme

Copyright © 2021 · Powered by WordPress · Log in