Introducing Cloudways Community Forum. Start Discussions and Get Instant Help From Cloudways Community. JOIN NOW

How to Configure WP Rocket Plugin for WordPressApril 29, 2016

 

In this KB

  • Downloading WP Rocket plugin
  • Removing W3 Total Cache
  • Installing WP Rocket
  • Configuring WP Rocket

 

This guide will explain how you can use WP Rocket plugin with your WordPress/ WooCommerce website on the Cloudways Cloud platform.

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.

WP rocket Pricing

Step 2: Log into WordPress Admin

Log into WordPress admin area of your site with your credentials.

WordPress Login

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.

Wordpress Add Plugin

Once installed, then activate the plugin from 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 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.

Varnish configuration

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 OPCache

Important Notes:

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 exists.
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.

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.

varnish

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:

LazyLoad

Minification

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=(.*) . This will allow the minification process to run smoothly.

  1. Go to Application Management
  2. Click on Application Settings
  3. Go to Varnish Settings tab and click on Add New Rule to add the value as shown in the screenshot. 

Cloudways Varnish Settings

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.

Check the WP Rocket documentation if you have any additional problems, or open a support ticket and the WP Rocket team will be happy to help you out.

Have Questions? Ask From Our Helpful Community

7 Responses

  1. Christian says:

    Did you guys ever figure out a fix for WP Rocket minification and Varnish? That’s one of the best features of their plugin 🙁

    • Jeremy Whiteley says:

      Did you guys figure the Varinish and WP Rocket Minification yet?

    • Manju Th says:

      Disabling Varnish and Making full use of Wp Rocket seems to the best available option.

    • Manju Th says:

      After lot of trials I have settled with the following options.

      Option 1) Disable Varnish + Use optimum settings on Wp Rocket and Cloudflare (if you are using cloudflare).

      Option 2) Enable Varnish, Uncheck CSS and JS in File Optimization in Wp Rocket settings + Turn off Rocket Loader in Speed section of Cloudflare (if you are using cloudflare) + Install a plugin called Merge + Minify + Refresh.

      Option 2 is certainly better.

      Merge + Minify + Refresh is not as good as Wp Rocket when it comes to minification and concatenation but it still does a good job.

  2. Derek Smith says:

    I found this out the hard way, finally landed on the solution of using Autoptimize: https://wordpress.org/plugins/autoptimize/
    I’ve found I get better results than Merge + Minify + Refresh IMO

  3. Manju Th says:

    Did just like what is said in the article. Woocomerce load time fell down to 1.5 secs from 4 seconds. Wp Rocket and Cloudways are two exceptional services.

Still need help? Our support team is waiting to help you. Ask them now