Skip to main content

How to Configure WP Rocket Plugin for WordPress

Install and configure WP Rocket on Cloudways to speed up WordPress with caching, Varnish auto-purge, minification, LazyLoad, Breeze support.

Written by Usama Zafar
Updated over 8 months ago

WP Rocket is one of the most popular WordPress caching and performance optimization plugins, widely used to improve website speed, reduce load times, and enhance the overall user experience.

On the Cloudways Platform, WP Rocket works seamlessly with built-in features like Varnish, OPCache, and Object Cache Pro, ensuring your WordPress or WooCommerce site performs at its best.

This guide walks you through the complete process of installing and configuring the WP Rocket plugin on Cloudways, including key settings such as page caching, browser caching, Varnish auto-purge, minification, and LazyLoad.

While Cloudways also offers its own free Breeze Cache Plugin, WP Rocket provides advanced options for users who need greater flexibility and fine-tuned performance controls.

Try Breeze – Cloudways’ Free WordPress Cache Plugin

Boost your site speed with Breeze, the performance plugin built by Cloudways. It’s free, simple to configure, and fully optimized for WordPress and WooCommerce.


Table of Contents:


How to Configure and Optimize WP Rocket Plugin for WordPress on Cloudways?

Cloudflare and WP Rocket are two powerful tools that, when integrated, can significantly enhance website performance.

However, understanding how to configure caching, manage interactions between these tools, and troubleshoot common issues is essential for optimal results.

This guide addresses the most frequently asked questions about using Cloudflare caching and WP Rocket together on Cloudways hosting.

How to Configure WP Rocket Plugin for WordPress

Step #1 - Download WP Rocket Plugin:

Go to the WP Rocket site and choose the plan as per your requirements. Place the order after filling a small form and then download the zip file to your local computer.

Step #2 - Log in to WordPress Admin:

Log in to the WordPress admin area of your site with your credentials.

Step #3 - Remove W3 Total Cache:

You need to deactivate and delete W3 Total Cache (Cloudways default caching plugin) and any other installed optimization plugins from your WordPress site to avoid any conflicts.

Step #4 - Install WP Rocket:

Under the Add Plugins section, click on the Upload Plugin option. Then click Choose File to provide the path of your downloaded WP Rocket zip file and click the Install Now button.

Once installed, then activate the plugin from the Installed Plugins section. License activation happens when you activate the plugin, so no need to enter an API key.

Step #5 - Configuring WP Rocket:

Page caching is activated by default when you activate WP Rocket. Likewise, optimal rules for browser caching, GZIP, and other performance enhancements are also added by default to your .htaccess file.

Varnish Cache Purge

If the Varnish service is enabled on your server at Cloudways (it is by default), then go to the Varnish tab in WP Rocket and check the box to Enable the Varnish caching auto-purge.

This replaces the need to use the Varnish HTTP Purge plugin.

Cloudways provides OPCache too, and you will automatically see a Purge OPCache link in the WP Rocket admin toolbar in case you need to purge it.

Purge Varnish When Using a Proxy

When you use a proxy, e.g. Cloudflare, clearing varnish cache may not work effectively.

To fix this, you will need to use the following code snippet as explained below:

  1. Create a folder named mu-modules in your wp-content folder. Do not create another folder if mu-modules already exist.

  2. Using a basic text editor create a new file and put the following code in it.

Tip:

Remember to replace example.com with your domain name.

<?php
defined( 'ABSPATH' ) or die( 'Cheatin&#8217; uh?' );
/**
* Plugin Name: Fix Varnish Auto Purge with Proxy and WP Rocket
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/

add_filter( 'rocket_varnish_purge_request_host', '__rocket_varnish_custom_hostname' );
function __rocket_varnish_custom_hostname() {
return 'example.com';
}


add_filter( 'rocket_varnish_ip', '__rocket_varnish_custom_ip' );
function __rocket_varnish_custom_ip() {
return 'localhost';
}

3. Save the file as wp-rocket-varnish-purge-proxy.php
4. Upload this file to the mu-modules folder created in step 1.
5. Finally, make sure to deactivate and re-activate WP Rocket (you may also need to manually clear the cache of your proxy).

To verify if Varnish was properly cleared, you can check the Age header. To do that in Chrome, first, open Developer Tools:

Chrome Menu → More Tools → Developer Tools OR Press Ctrl+Shift+I

Then click on the Network tab, and reload your website.

Look at the first request and check the value of the age header. This is the age of the Varnish cache, in seconds.


Immediately after purging, it will reset to 0.

LazyLoad and Minification

LazyLoad and minification can cause display issues, depending on the specific theme and plugins you are running. So we recommend enabling those options 1-by-1, then checking your site in a logged-out window, to see if there are any issues.

If you have issues, consult the documentation on resolving them:

You can also disable the option and clear the cache to set your site back to normal.

Minification and Varnish

In order to run WP Rocket CSS / JS minification while Cloudways Varnish is activated, you can add a URL exclusion of /(.)/?f&#x3D;(.) . This will allow the minification process to run smoothly.

How Does Cloudflare Interact with Server-Side Caching Systems?

If you employ server-side Varnish caching on Cloudways, it will be bypassed whenever Cloudflare's edge caching is actively serving content.

When Cloudflare operates as a reverse proxy (indicated by the "orange cloud" status), it responds directly to requests using its cached version, bypassing Varnish and other origin-based caches.

This is normal behavior unless Cloudflare misses the cache, at which point Varnish will handle the request if its own cache remains populated.

  1. Under Application Management, Click Application Settings.

  2. Go to the Varnish Settings tab and click on Add New Exclusion to add the value as shown in the screenshot.

Preload Bot

Depending on your site, the preload bot can consume additional server resources. If you have any issues with it, it can be easily disabled by following this simple guide.

Optimizing WP Rocket with Cloudflare

WP Rocket and Cloudflare must be configured to avoid conflicting rules:

  1. Set up Cloudflare caching rules directly on its dashboard.

  2. Ensure any WP Rocket settings are reviewed for potential overlaps with Cloudflare configurations.

  3. For regular updates to your website, Cloudflare's enterprise version enables automated "cache purge" integration if WP Rocket lacks this feature. Otherwise, manual purging after updates guarantees that changes reflect promptly on the website.

Check the WP Rocket documentation if you have any additional problems.

Key Takeaways

  • Cloudflare caching complements WP Rocket to optimize site performance.

  • Disabling Cloudflare is not recommended for long-term use but can help in certain tests or troubleshooting scenarios.

  • Configuration conflicts (e.g., overlapping cache rules) should be minimized for smooth integration.

  • Regularly purge Cloudflare's cache after significant updates when using WP Rocket.

  • Performance issues routed via Cloudflare's nodes might require further evaluation or support consultation. By following the outlined steps and understanding the interactions between Cloudflare and WP Rocket, you can effectively manage and optimize your website’s caching configuration.


FAQs

Can Cloudflare Caching Be Disabled While Exclusively Using WP Rocket?

Disabling Cloudflare caching entirely is not feasible as it handles primary caching for your site, even when WP Rocket is in use. Cloudflare's caching cannot be entirely overridden by settings in WP Rocket, making both tools complementary. You can, however, use them effectively together to optimize performance.

Why Can't WP Rocket Replace Cloudflare Caching Alone?

Cloudflare caching operates at the network edge, providing significant performance benefits through faster delivery of cached content to users globally. However, to disable Cloudflare's caching completely, specific HTTP headers like no-cache or no-store must be implemented. These headers conflict with WP Rocket's caching strategies, preventing its effective standalone operation. If complete cache control is required, consider leveraging Cloudflare-enterprise-level features.

Are There Any Other Active Caches on Cloudways?

No, Cloudflare and WP Rocket are the only active caching systems typically utilized on a Cloudways-hosted website. Cloudways does not implement additional server-side caching unless explicitly enabled. For specific configurations, check with your hosting provider.


Quick Tip!

Cut down server loads with Cloudways built-in cache plugins, and enjoy speed boosts.


That's it! We hope this article was helpful.

Need Help?

If you need assistance, feel free to:

  • Visit the Cloudways Support Center

  • Chat with us: Need a Hand > Send us a Message

  • Or create a support ticket anytime.

We're here 24/7 to help you!

Did this answer your question?