How to Install Varnish on Drupal 7

by Hamza Zia  June 15, 2017

Previously in the quest to maximize the performance of a Drupal 7 website hosted on Cloudways, I’ve shown you the installation process for Redis and Memcache for Drupal. In this post, I will demonstrate how to install Varnish on Drupal 7.

Varnish on Drupal 7 Banner

To get a complete idea of what a powerhouse Varnish truly is, read its Wikipedia page. To give you a taste of its power, consider the fact that Varnish could speed up your website up to 300 times.

So, without further ado, let’s get into it. Here are the steps involved in the process:

  1. Setup Varnish on the server
  2. Ensure Varnish is running on the server
  3. Enable Varnish on your Drupal application
  4. Install Varnish module on Drupal website
  5. Configure Varnish settings
  6. Verify Varnish is operational on your website

Setup Varnish on the Server

The real advantage of using Cloudways is that you get Varnish pre-installed on your server. This means that you don’t have to deal with the hassles of setting up Varnish and entering long commands at the CLI to get it running on your server. This is just one way on which Cloudways offer peace of mind to its customers.

Ensure Varnish is running on the Server

To make sure that Varnish is running on your server, you can check its status in just a few clicks. Simply navigate to your server’s dashboard and click the Manage Services tab in the left sidebar.

Cloudways running services

Here, you will be presented with the various services running on the server. Locate Varnish and verify that the status is green (running). You can also purge it or disable it (in one click) from this location.

Enable Varnish on your Application

The really cool thing about Cloudways is that not only can you enable Varnish on your server through the really easy-to-use GUI, but you can also enable it on your application in much the same way. Simply navigate to your Drupal application’s dashboard and click the Application Settings button in the left toolbar.

Application settings

Simply click the Varnish toggle to enable it.

Install the Varnish Module on your Drupal website

Now, normally in the case of other hosts, you will be required to install the Varnish module for Drupal 7 yourself. However, in the case of Cloudways, you will notice in the Drupal module’s list that the Cloudways already provides the Varnish module pre-installed and enabled on your site.

Drupal Varnish Module install

Configure Varnish Settings

Next, you can go to the Varnish module’s configuration page and change any settings to your preferences. Although the choice of the settings is up to you, remember that messing up with settings could seriously impact the performance of your website.

Verify that Varnish is Active on your Website

The last step of the process is the confirm that Varnish is active on the Drupal website. The easiest method is through the network tab in the Google Chrome’s inspect element. Go to your Drupal website and log out. Right click anywhere on your website and click inspect. This will bring up the following screen:

Inspect

Click the network tab on the top and refresh the page.

Inspect Network

Now click the name of your website. This will open a new sub-tab. In this section, click the header tab and locate X-Varnish-Cache heading. Make sure it is set to HIT. This shows that Varnish is running properly on your website.

Inspect network varnish status

Conclusion

Cloudways makes it incredibly easy to deploy the best caching methods available right now. Installing Varnish is a breeze on a Drupal website hosted at Cloudways, thanks to the very simple GUI.

If you need further help with the process, do leave a comment and I will get back to you.

 

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Hamza Zia

Hamza is a Drupal Community Manager at Cloudways - A Managed Drupal Hosting Platform. He loves to write about Drupal and related topics. During his free time, he can be seen obsessing over Football, Cars, Android and Gaming.

Stay Connected:

You Might Also Like...