A fresh WordPress site is quick when it has ten posts and no visitors. Add WooCommerce, a page builder, a dozen plugins and real traffic, and every page view becomes PHP execution plus a stack of database queries. Time to first byte climbs, the server's CPU stays busy, and a traffic spike can take the site down.
Caching fixes most of this. This guide shows how to deploy WordPress on SharkCluster and then add two layers of cache: Redis for database query results (the WordPress object cache) and Varnish for full pages. Together with OPcache, which is already on, they let the server answer most requests without running WordPress at all.

How the three caching layers fit together
| Layer | What it caches | Who benefits |
|---|---|---|
| Varnish | Complete HTML pages, in memory, in front of the web server | Anonymous visitors: blog readers, product page browsers, search engine crawlers |
| Redis object cache | Results of database queries and expensive lookups | Everyone, including logged-in users, wp-admin and WooCommerce cart/checkout |
| OPcache | Compiled PHP code | Every PHP request |
Varnish gives the biggest speed-up, but only for pages that are the same for every visitor. Redis covers what Varnish can't: logged-in sessions, the admin area, carts and checkout. Use both.
With Varnish in place, a request flows like this:
Visitor
→ NGINX or Apache on ports 80/443 (handles HTTPS)
→ Varnish (serves the page from memory if it has it)
→ Web server on a backend port → PHP-FPM → WordPress → MySQL
↘ Redis (object cache)Step 1: Create a server
Go to Servers → Create Server, pick DigitalOcean, Contabo or OVHcloud, choose the region closest to your visitors and select a plan. For a business site or a small WooCommerce store, 2 vCPU and 4 GB RAM is a comfortable start; Redis and Varnish both use memory, so leave room for them. You can resize later.

Step 2: Deploy WordPress
Open the server, go to Applications and click Create Application. Then:
- Application name. A name you'll recognise, for example
company-site. - Choose webserver. NGINX or Apache. Choose Apache if your plugins rely on
.htaccessrules (many security and redirect plugins do); NGINX otherwise. - Select application type. Open the CMS & E-commerce tab and select WordPress.
- Database. MySQL (default) or MariaDB. SharkCluster creates the database, user and password and wires them into WordPress for you.
- How to set up the application. Fresh Installation for a new site. If you're moving an existing site, use Deploy from Git Repo or Upload ZIP; both let you pick the PHP version your code needs.
- Automated backups. Choose daily or weekly and the time they run.
Check the summary and click Create Application. The installation page shows progress while the stack is set up.

Every PHP application runs in its own PHP-FPM pool, so one busy site doesn't slow down the others on the same server. SharkCluster doesn't charge per site, so you can run many client sites on one server.
Step 3: Add your domain and free SSL
Open the application and go to Domains → Add domain:
- Enter your domain, for example
example.com. - Keep Automatic HTTPS & SSL on for a free Let's Encrypt certificate that renews automatically. Choose whether visitors land on the www or non-www version; the other gets a 301 redirect.
- Add the A record shown under Required DNS Records at your DNS provider, click Check DNS and then Save Domain.
DNS usually propagates in 2 to 30 minutes, after which the certificate is issued. The step-by-step version is in how to add a domain to your application, and if you use Cloudflare, see how to integrate Cloudflare.
WordPress stores its site URL in the database. If you installed it before adding the domain, update WordPress Address and Site Address under Settings → General in wp-admin to the new https:// address.
Step 4: Log in to wp-admin
The administrator account is created during installation. Open the application's Access tab: the Admin Login section shows the admin panel URL, the username and the password, with a button to open the login page.

Change the password after your first login and create named accounts for anyone else who needs access.
Step 5: Install Redis and turn on the object cache
Install Redis on the server
Go to the server's Packages page, open the Browse tab, filter by Caching (or search for redis) and click Install on Redis. It moves to the Installed tab with its status, version and port when it's ready.

Redis listens on 127.0.0.1:6379 only, so it isn't reachable from the internet. From Details & Config you can change the idle timeout and maximum connections, and read Redis logs.
Set a memory limit
Give Redis a memory ceiling and an eviction policy so a full cache drops old keys instead of growing without limit. Open the web console (application Security → Access) or SSH in and edit /etc/redis/redis.conf:
maxmemory 256mb
maxmemory-policy allkeys-lrusudo systemctl restart redis-server256 MB is plenty for most single sites. Increase it for large WooCommerce catalogues or when several sites share the server.
Connect WordPress to Redis
In wp-admin, go to Plugins → Add New, install and activate Redis Object Cache (by Till Krüss). Then add these lines to wp-config.php above the line that says /* That's all, stop editing! */. You can edit the file from the application's File Manager:
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_PREFIX', 'company-site:' ); // unique per site
define( 'WP_CACHE_KEY_SALT', 'company-site:' );Use a unique prefix for each WordPress site on the server. Redis is shared by every application on the server, so two sites without separate prefixes can read each other's cached data.
Back in wp-admin, open Settings → Redis and click Enable Object Cache. The status should change to Connected.
Step 6: Install Varnish and put it in front of WordPress
Install Varnish
On the same Packages → Browse page, filter by Caching and install Varnish Cache.
Installing Varnish doesn't route traffic through it yet. A fresh install listens on port 6081 and expects the web server on a backend port, while NGINX or Apache keeps serving your site on 80/443. To place Varnish in front of the site, click Request Setup at the bottom of the Browse tab (or contact support) and the SharkCluster team will reconfigure the web server for you. Your web server continues to handle HTTPS, because Varnish doesn't speak TLS.

Use a WordPress-safe VCL
Varnish's rules live in /etc/varnish/default.vcl. The most important rule for WordPress is never cache pages for logged-in users, or one visitor could see another's account page or cart. Ask for a WordPress VCL during setup, or apply one yourself. A minimal version:
vcl 4.1;
backend default {
.host = "127.0.0.1";
.port = "8080";
}
acl purge {
"127.0.0.1";
"localhost";
}
sub vcl_recv {
# Allow purge requests from the server itself (cache purge plugin)
if (req.method == "PURGE") {
if (!client.ip ~ purge) { return (synth(405, "Not allowed")); }
return (purge);
}
# Only cache GET and HEAD
if (req.method != "GET" && req.method != "HEAD") { return (pass); }
# Never cache admin, login, cron, REST API or WooCommerce pages
if (req.url ~ "^/(wp-admin|wp-login\.php|wp-cron\.php|wp-json|xmlrpc\.php)" ||
req.url ~ "^/(cart|checkout|my-account)" ||
req.url ~ "(\?|&)(add-to-cart|wc-ajax)=") {
return (pass);
}
# Never cache logged-in users, commenters or visitors with a cart
if (req.http.Cookie ~ "wordpress_logged_in_|wordpress_sec_|wp-postpass_|comment_author_|woocommerce_items_in_cart|wp_woocommerce_session_") {
return (pass);
}
# Everyone else: drop cookies so the page can be cached
unset req.http.Cookie;
return (hash);
}
sub vcl_backend_response {
# Cache pages for 1 hour; serve stale content for up to 6 hours if PHP is slow or down
if (bereq.url !~ "^/(wp-admin|wp-login\.php|cart|checkout|my-account)") {
unset beresp.http.Set-Cookie;
set beresp.ttl = 1h;
set beresp.grace = 6h;
}
}Set the backend port to the one your web server listens on after setup. Check the file and reload Varnish without dropping the cache:
sudo varnishd -C -f /etc/varnish/default.vcl > /dev/null && echo "VCL OK"
sudo systemctl reload varnishIf users ever report seeing someone else's account or cart, logged-in pages are being cached. Stop Varnish from the Installed tab or restore the previous VCL immediately, then fix the cookie rules.
Purge the cache when content changes
With a one-hour TTL, edits can take up to an hour to show. Install the Proxy Cache Purge plugin in WordPress: it sends a PURGE request for the affected pages whenever you publish or update a post, and the acl purge block above allows those requests from the server itself.
To clear everything by hand, run this in the web console:
# Clear the whole cache
sudo varnishadm "ban req.url ~ ."
# Clear one section, e.g. the blog
sudo varnishadm "ban req.url ~ ^/blog"Restarting Varnish also empties the cache.
Step 7: Check that caching works
Request a page twice as an anonymous visitor and look at the response headers:
curl -sI https://example.com/ | grep -iE "^(age|x-varnish|via)"Age above 0 on the second request and two numbers in X-Varnish mean the page came from the cache. Then log in to wp-admin and confirm admin pages are not cached (Age stays at 0).
For Redis, the Settings → Redis screen in wp-admin shows the connection status and cache metrics. Watch CPU and response times on the application's Analytics page and the server's monitoring graphs: with both caches in place, CPU on a busy site should drop noticeably.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| 503 Backend fetch failed | Varnish can't reach the web server | Check the backend host and port in default.vcl match the web server's backend port, and that the web server is running |
| Changes don't appear on the site | The old page is still cached | Check that Proxy Cache Purge is active, or ban the URL with varnishadm |
| Users see another user's cart or account | Logged-in pages are being cached | Stop Varnish or restore the previous VCL, then fix the cookie pass rules |
| Redis Object Cache shows Not connected | Redis isn't running or the host/port is wrong | Check Redis on the Installed tab and the WP_REDIS_HOST and WP_REDIS_PORT values |
| Two sites show each other's data | Shared Redis without unique prefixes | Set a different WP_REDIS_PREFIX and WP_CACHE_KEY_SALT on each site, then flush the object cache |
FAQ
Do I need both Redis and Varnish?
Small brochure sites do well with Varnish alone. Anything with logged-in users, WooCommerce or a busy admin area benefits from Redis too, because Varnish passes those requests straight to WordPress.
Does Varnish work with WooCommerce?
Yes, as long as cart, checkout and account pages, and visitors with a cart cookie, bypass the cache. The VCL above does that.
Is SSL affected by Varnish?
No. NGINX or Apache still terminates HTTPS on port 443 with your free Let's Encrypt certificate, then hands the request to Varnish.
Can I use a caching plugin like WP Rocket as well?
You can, but disable its page cache to avoid caching the same page twice; keep its file optimisation features if you like them. Varnish handles page caching more efficiently in memory.
Next steps
Your WordPress site now runs on your own server with HTTPS, an object cache and a page cache. To go further, see 5 ways to optimize application performance on SharkCluster, the caching feature overview and SharkCluster for ecommerce. If you're moving an existing site, migrations are free: raise a ticket and the team will move it for you.
Run this on your own VPS
Deploy servers and applications on infrastructure you own, managed from one panel — backups, caching, firewall and monitoring included.

