Back to articles
AI & Cloud

Guide to Deploy Ghost CMS on Cum VPS with Cloudflare Auto Cache Purge on Post Publish

A detailed guide to deploy Ghost CMS on Cum VPS and integrate with Cloudflare to automatically purge cache when publishing posts, ensuring instant content updates.

DPTCloud Engineering4 min read
Guide to Deploy Ghost CMS on Cum VPS with Cloudflare Auto Cache Purge on Post Publish

Image credit: KELLEPICS · Pixabay Content License

Introduction

Ghost CMS is an open-source blogging platform optimized for fast and efficient content publishing. To ensure content updates are visible immediately after publishing, integrating with Cloudflare to automatically purge the cache is essential. This guide walks you through deploying Ghost CMS on Cum VPS and setting up automatic cache purging when a post is published.

System Requirements

  • Cloud VPS (Cum VPS) with at least 4GB RAM
  • Public IP address
  • Node.js (version 16 or higher)
  • MySQL or PostgreSQL database
  • Registered Cloudflare account
  • Ghost CLI tool

Deploy Ghost CMS on Cum VPS

Run the following commands on your VPS to install Ghost CMS:

sudo apt update
sudo apt install -y nodejs npm
sudo npm install -g ghost-cli
ghost install --production

After installation, Ghost CLI will guide you through configuring the database and domain. Make sure to select the "production" option to install the stable version.

Integrate Cloudflare for Auto Cache Purge

To automatically purge the Cloudflare cache when a post is published, set up a Webhook in Ghost CMS that calls the Cloudflare API.

First, obtain your API token from Cloudflare:

  1. Log in to your Cloudflare account
  2. Select the website you want to manage
  3. Go to "API" → "API Tokens" → "Create Token"
  4. Create a token with permissions "Zone:Cache:Purge" and "Zone:Read"

Then configure the Webhook in Ghost CMS:

ghost config set webhook.url https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/purge_cache
ghost config set webhook.headers.Authorization "Bearer {API_TOKEN}"
ghost config set webhook.events post-published

Replace {ZONE_ID} and {API_TOKEN} with your actual values.

Verify and Test

After configuration, publish a new post and verify the cache is purged:

  • Open your browser and visit your website
  • Wait a few seconds after publishing
  • Refresh the page to check if the new content appears

If the new content appears immediately, the cache purge was successful.

Troubleshooting

  • Cache not purged: Verify the API token is correct and has the required permissions.
  • Webhook not working: Check Ghost CMS logs for errors.
  • Cache not updating: Ensure Cloudflare isn't using stale cache due to DNS or CDN settings.

References

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478