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.
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:
- Setup Varnish on the server
- Ensure Varnish is running on the server
- Enable Varnish on your Drupal application
- Install Varnish module on Drupal website
- Configure Varnish settings
- Verify Varnish is operational on your website
Nothing as Easy as Deploying Drupal Apps on Cloud
With Cloudways, you can have your Drupal apps up and running on managed cloud servers in just a few minutes.
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.
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.
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.
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:
Click the network tab on the top and refresh the page.
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.
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.