Skip to main content

Nginx Server Side Caching

The Nginx Proxy Cache feature in cPGuard X improves website performance and reduces backend load by storing generated responses and serving them directly from memory or disk for subsequent requests. Instead of every visitor triggering PHP execution and database queries, frequently accessed content is delivered instantly from cache.

Benefits of Nginx Server-Side Caching

BenefitDescription
Faster page load timesCached responses are served without hitting PHP or the database
Reduced CPU and database usageBackend processing is skipped for cached requests
Better traffic spike handlingHigh concurrent visitors are served from cache without overloading the server
Improved user experiencePages load significantly faster for all visitors

:::tip No Plugin Required This cache operates entirely at the server level. It works even if your application has no caching plugin installed — making it effective for any CMS or custom application. :::


Where to Find the Settings

Nginx Proxy Cache settings are managed per website. Navigate to:

Dashboard → Websites → Select Website → Advanced → Nginx Settings → Server-side Cache

cPGuard X  nginx proxy

cPGuard X  nginx proxy


Available Cache Options

cPGuard X  nginx proxy

1. Enable Cache

Turns the Nginx proxy cache on or off for the selected website.

SettingBehaviour
ONResponses are cached and served to visitors when eligible
OFFEvery request is passed directly to the backend — no caching
note

When the cache is disabled, all exclusion rules and purge options have no effect.


2. URL / Path-Based Exclusions

cPGuard X  nginx proxy

If a request URL contains a defined path or fragment, caching will be skipped for that request and it will always be served fresh from the backend.

Use this for dynamic or sensitive pages such as:

  • /cart
  • /checkout
  • /my-account
  • /api/

Example: If /checkout is added as an exclusion, any URL containing /checkout will never be served from cache.

Automatic Exclusions for WordPress

To prevent accidental caching of sensitive areas, the system automatically bypasses the following WordPress locations by default:

  • /wp-admin/
  • /wp-login.php
info

You do not need to add these WordPress paths manually as they are already excluded out of the box.


Requests that contain specific cookies will bypass the cache entirely.

This is especially useful for:

  • Logged-in users — to ensure they always see personalised, up-to-date content
  • Active sessions — such as users with items in a shopping cart
  • Personalised content — where serving a cached response would show incorrect data

When a matching cookie is present in the request, Nginx skips the cache and passes the request directly to the backend.


4. Full Cache Purge

Deletes all cached files for the selected website at once.

:::danger Irreversible Action A full cache purge cannot be undone. After purging, the first visitor to each page will trigger a fresh backend request to rebuild the cache. :::

When to use a full purge:

  • After deploying major site updates
  • After changing the theme or design
  • After making global content modifications that affect multiple pages

5. Purge Specific URL

Removes the cached version of a single page or path without affecting the rest of the cache.

Examples:

  • /blog/new-post
  • /pricing
  • /products/item-name

When to use targeted purge:

ScenarioRecommended Action
Edited a single blog postPurge that specific URL
Updated one product pagePurge that product's URL
Changed pricing on one pagePurge /pricing only
Redesigned the entire siteUse Full Cache Purge instead

Targeted purging is the preferred approach for routine content updates as it preserves the rest of the cache, keeping your site fast while still serving the latest version of the updated page.


How the Cache Works — Overview

Visitor Request

Is the URL/Cookie excluded?
↓ No ↓ Yes
Is there a cached Pass to Backend
response available? (PHP + Database)
↓ Yes ↓ No
Serve from Pass to Backend → Cache the Response → Serve to Visitor
Cache

Summary

The Nginx Proxy Cache in cPGuard X is a powerful, zero-configuration-required performance feature. By caching responses at the server level, it dramatically reduces backend load and delivers faster pages to your visitors. Use URL and cookie exclusions to ensure dynamic or personalised content is always served fresh, and use targeted URL purging for routine updates to avoid unnecessary full cache clears.