Varnish Cache

Varnish Cache is an open-source reverse HTTP proxy that is used by millions of websites worldwide for web acceleration and content caching. When deployed on Digital Ocean, it can cache HTTP content to speed up delivery significantly (300 - 1000%!) and reduce backend server load by up to 99%. It does this by caching and storing a copy of the web content the first time a user visits, and then delivering it directly from the cache for future requests. This means your web service can stay fast and online even during busy periods, providing an excellent web experience to your visitors at all times. Varnish Cache 6.0.11 is the latest LTS release.

Highlights:

  • High-performance, scalable internet operations. Deliver websites, APIs and video 300% faster and handle high demand.
  • Put edge PoPs anywhere. Deploy Points-of-Presence (POPs) where you need them, for fast content delivery to target audiences.
  • Stay online. Reduce backend server load by up to 99%, for handling traffic spikes easily.
  • Flexibility and freedom. A built-in edge computing logic (Varnish Configuration Language) lets you customize your caching setup to suit exact requirements.

You can learn more in the new book Varnish 6 by Example, an essential guide to all things Varnish 6, including tutorials for and modules across Varnish Cache and Varnish Enterprise.

Software Included

Package Version License
Varnish 6.0.12 FreeBSD
varnish-plus-addon-ssl (Hitch) 1.8.0 BSD

Creating an App using the Control Panel

Click the Deploy to DigitalOcean button to create a Droplet based on this 1-Click App. If you aren’t logged in, this link will prompt you to log in with your DigitalOcean account.

Deploy to DO

Creating an App using the API

In addition to creating a Droplet from the Varnish Cache 1-Click App using the control panel, you can also use the DigitalOcean API. As an example, to create a 4GB Varnish Cache Droplet in the SFO2 region, you can use the following curl command. You need to either save your API access token) to an environment variable or substitute it in the command below.

curl -X POST -H 'Content-Type: application/json' \
         -H 'Authorization: Bearer '$TOKEN'' -d \
        '{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image": "varnishsoftware-varnishcache-18-04"}' \
        "https://api.digitalocean.com/v2/droplets"

Getting Started After Deploying Varnish Cache

In addition to the package installation, the One-Click also:

  • Enables the UFW firewall to allow only SSH (port 22, rate limited), HTTP (port 80), and HTTPS (port 443) access.
  • Sets Varnish to answer on port 80 and 8443
  • Set Hitch to answer port 443 and forward request to varnish on port 8443
  • Add a welcome page you can see when visiting the Droplet’s IP address in your browser.

After you create a Varnish One-Click Droplet:

  • You can log into the Droplet as root using either the password emailed to you or with an SSH key, if you added one during creation.
  • Get more help on the welcome page by visiting the Droplet’s IP address in your browser.