UltraStack Utilities for Caching in Platform InMotion

Platform InMotion UltraStack Utilities - article image

Your Platform InMotion production site will have the ability to use NGINX caching on the server, this can result in faster website performance since it does not have to generate content in real-time. You can select from pre-configured profiles that are built for specific types of websites. Then you can set your purge settings using a plugin such as NGINX Helper.

This ensures your visitors are seeing the latest version of your website and not old cached content. In this guide, we’ll go over the UltraStack Utilities that are available on your cloud WordPress server to help you manage your cache settings via SSH. Then we’ll show you how to select your caching profile and manage your cache settings using NGINX Helper.

Cache Profile Options

Below is a breakdown of the available profile options that you can choose from.

Caching ProfileDescription
No CachingTurns caching off but you will still have static content acceleration and brute force rate-limit protection running.
WordPressGeneral-purpose profile compatible with most WordPress and WooCommerce sites, but it is recommended to use a cache-control plugin such as W3 Total Cache to handle purging (clearing) the cache when content is updated.
WordPress MultisiteThis is the same as the WordPress profile but built specifically for Multisites (Networks), but allows Apache to perform required path rewrites by disabling Accelerate Static Content.

Note: This is the best option to use with W3 Total Cache, because it would allow minify and concatenate functions to work appropriately and you can set the page cache to store on disk, which would serve it from NGINX cache directly before reaching the application level on request.
WordPress MicrocacheRecommended for sites where full page caching is not a good option due to the dynamic nature. This can help neutralize high increases in traffic to your site.
Pass AllSelect this to pass all traffic to Apache in case you do not want to utilize any caching, ratelimit protection, or optimizations. We recommend using the No Caching profile instead if you want to disable caching.
Honor HeadersThis profile honors the Cache, Expires, and X-Accel-Expires headers set by the application. If not set, a default 60 second expiration time is used. All other values match the WordPress profile.

Note: This can be used with W3 Total Cache effectively as well, because it allows you to modify or customize the response headers to control cache on the client-side, server, and CDN levels.

Set Your Caching Profile

Set Caching Profile From Platform InMotion

Platform InMotion includes pre-configured NGINX profiles that are custom-made for specific website needs. Here are the steps to easily select the one that best suits the type of site you are building.

  1. Login to Platform InMotion.
  2. Select the project you’d like to manage.
  3. Click the Manage Server link in the navigation menu.
  4. Click NGINX Settings.
  5. You will then see a list of the available NGINX profiles, for more information see the section above on Cache Profile Options. Select the one you want to use then click the Update Profile button.
    Update NGINX Profile Settings
  6. Click the Update Profile button to save your NGINX settings. The playbook will then run and setup the new NGINX profile for your server.

Managing Cache From the WordPress Dashboard

Now that you have your NGINX profile selected you can manage your cache using a WordPress plugin. NGINX Helper will be installed automatically but you can also find it on the WordPress.org Plugin Repository.

In this section, we’ll show you how to manage your cache from your WordPress Dashboard using NGINX Helper.

Using NGINX Helper

NGINX Helper will automatically be installed on your site, so you just need to access and choose your purge settings.

  1. Log into your WordPress Admin Dashboard
  2. Click Settings then NGINX Helper.
  3. Check the box to Enable Purge.
  4. You can then select your Purging Conditions as needed.
    NGINX Purging Conditions
  5. Click the Save All Changes button after choosing your settings.

Managing Cache With SSH

If you prefer to use SSH instead of a plugin to manage your cache, you have the ability to clear all cached data or just a single page.

View usutil Syntax and Examples

Bash
[root@vpsXXXXX ~]# usutil --help
usage: usutil [-h] [--domain DOMAIN] [--email ADDR] [--purge] [--purgeall] 
[--stats] [--info] [--span SPAN] [--lines X] [--logfile PATH] [--debug]
[--logdata] [--json] [--yaml] [--html] [--version][URL_OR_LOGFILE]

Nginx status reporting and cache manipulation utility

positional arguments:
  URL_OR_LOGFILE        Target URL when using --info or --purge modes; logfile when using report modes

optional arguments:
  -h, --help            show this help message and exit
  --domain DOMAIN, -d DOMAIN
                        Specify domain
  --email ADDR, -E ADDR
                        Email report to specified address
  --purge, -X           Mode: Purge cache for specified page
  --purgeall, -Z        Mode: Purge ALL cached data
  --stats, -S           Mode: Show cache stats [default]
  --info, -I            Mode: Show info for URL
  --span SPAN, -t SPAN  Parse specified span from logs (in hours)
  --lines X, -z X       Parse X number of lines from log tail
  --logfile PATH, -l PATH
                        Log output file
  --debug, -D           Enable debug output
  --logdata             Return logdata in JSON or YAML output
  --json, -J            Output format: JSON
  --yaml, -Y            Output format: YAML
  --html, -H            Output format: HTML
  --version, -v         show program's version number and exit

Purge All Cached data

usutil --purgeall

Purge Cache For a Specific page

usutil --purge http://example.com/page/

Stats & Reporting

Show cache stats [default]

usutil --stats

View Server Stats

Run the following command to view information about your server since it was last restarted.

Troubleshooting With –info

Run the following command to run a list of requests to help check the status of your cache.

usutil --info https://example.com

The above command will perform the following checks

  • Make a request to the target URL and check the response status
  • Calculates the total request time
  • Checks the X-Proxy-Cache header
  • Checks for a matching cache object in the user’s cache zone. If it exists, checks the cache expiration time and validity
  • Compares the target URI against the domain’s ngxconf config, then displays any matching rules
  • Determines if a page is considered ‘static content’, and whether it was served from NGINX or Apache
  • Displays Location redirects
  • Checks compression and content encoding
  • Checks for presence of the Vary header
  • Checks for presence of any cookies, then displays them
  • Displays which cache control headers are being trusted, according to the domain’s ngxconf config
  • Checks for the presence of the Upgrade header
  • Checks if Apache mod_http2 is installed and in use with NGINX
  • Checks the status of Apache, NGINX, and the associated PHP-FPM master
  • Parses and displays corresponding lines from the Apache, NGINX, and PHP-FPM error logs

Congratulations! Now you know how to select your caching profile and manage your cache settings using NGINX Helper and SSH.

Was this article helpful? Join the conversation!