Customers with Hypernode Professional and Excellence plans can use Varnish to boost their Magento shop. To manage and configure Varnish for Magento 1.x you’ll need Turpentine. This article explains how you can configure Varnish for your Hypernode. Do you have a Magento 2 shop, please check this article.

Although Varnish is extremely awesome when it get’s to speeding up websites, Varnish is a complex technique that needs some experience to set it up. Don’t implement Varnish on production nodes while still under development but use a development node or a local staging environment like the Hypernode Docker instead.

Configure Varnish for Magento 1.x

Activate Varnish

Before installing Turpentine we recommend changing the Varnish Cache settings.

All customers: via the hypernode-systemctl tool

Activating Varnish and set which version to use on your Hypernode can be done via the hypernode-systemctl tool.

Dutch customers: via your Service Panel

Only Dutch customers can also easily activate Varnish via their Service Panel. Go to ‘Instellingen’ and change Varnish to ‘Actief’. Once you’ve changed this setting and enabled Varnish in Magento, Varnish will store all information in it’s own cache. Only when Varnish needs data that hasn’t been cached it will connect with the server.

English speaking customers: via your control panel

English speaking customers who ordered their Hypernode via Hypernode.com have access to a control panel. Find your Hypernode, click on ‘Settings’ and go to ‘Caching’. There you can enable Varnish with 1 click on the button.

Install Turpentine

Installing Turpentine works best with Magento Connect Manager:

  • Log on to your backend
  • Navigate to System > Magento Connect > Magento Connect Manager
  • Fill in your admin credentials
  • Paste the following key in the field next to Paste extension key to install: http://connect20.magentocommerce.com/community/Nexcessnet_Turpentine
  • Install
  • Click Proceed
  • Turpentine will now be installed
  • Log off and on again so Turpentine will appear in your admin
  • Flush your Magento cache via the backend (System → Cache Management)

When the Magento Connect Manager is not available, Turpentine needs to be installed by manually:

There are a couple of options for this:
* Download and install the tarball package from the Downloads page on GitHub (note that this is not the “Download as tar.gz” option) and install through Magento Connect Downloader or Magento’s mage command.
* Install with Modman. You would just need to use: modman clone https://github.com/nexcess/magento-turpentine.git

Note: If you install with modman you should also set System > Configuration > Developer > Template Settings > Allow Symlinks to “Yes”.

Configure Turpentine

After installing Turpentine and flushing the Magento cache, you can start configuring Turpentine:

  • Log on to your Byte Service Panel
  • Select your Hypernode plan
  • Click on the tab Instellingen
  • Select the option Varnish
  • You’ll notice Varnish cache is non-active. This is necessary for testing your shop with Varnish. (See ‘Test your shop with Varnish’ below)
  • Don’t close this page, you’ll need this information later
  • Log on to your Magento backend
  • Navigate to System -> Configuration
  • Select Varnish Options under Turpentine
  • In the Servers section, fill in the following information:
    • Varnish version: leave this on ‘auto’
    • Varnish server list: varnish:6082
    • Varnish authentication key: Paste the content from your Service Panel here
  • Select Caching Options under Turpentine
  • Check if the following information is correct:
    • Backend host: This should say varnish
    • Backend port: This should say 8080
    • Crawler ip’s: Remove localhost/127.0.0.1 from the crawler ip’s
  • Navigate to System -> Cache Management
  • Enable >Varnish Pages and >Varnish ESI Blocks
  • Click Apply Varnish Config below to complete the configuration

Test your shop with Varnish

We highly recommend you to test Varnish on a staging environment first. This way you’ll make sure your shop is completely optimized and ready to use Varnish.

There are 2 ways to create a Hypernode staging environment for testing Varnish;

  1. Hypernode development plan
  2. The Hypernode Docker

We recommend you to use a development node (which can be cancelled any time). A basic staging environment doesn’t work well with Varnish.

Debugging headers

If you want debugging headers, please remember to enable those in the admin backend under Varnish settings.

varnish headers

Depending on the version of turpentine you use, sometimes it’s needed to add your ip to the debug_acl in the vcl. This enabled debug headers for your IP address.

Varnish with PHP7

The current stable release of the Turpentine varnish extension is compatible with PHP7.

Warm your cache with the Turpentine cache-warmer script

Turpentine is shipped with a cache warmer. To use this script copy it to your home directory:

Now you can warm your Varnish cache by retrieving the sitemap.xml:

Which will crawl all URLs defined in the sitemap.xml:

Troubleshooting

  • If your Varnish setup is not working over SSL, check this article.
10