varnish

Getting started with varnish

Remarks#

This section provides an overview of what varnish is, and why a developer might want to use it.

It should also mention any large subjects within varnish, and link out to the related topics. Since the Documentation for varnish is new, you may need to create initial versions of those related topics.

Versions#

VersionRelease Date
5.1.22017-04-07
5.1.12017-03-16
5.02016-09-15
4.1.52016-02-09
4.0.42016-11-30
3.0.72015-03-23

Installation or Setup

The following are instructions to setup latest version of Varnish on various Linux distros.

CentOS 7

curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.rpm.sh | sudo bash

Ubuntu

apt-get install apt-transport-https
curl https://repo.varnish-cache.org/GPG-key.txt | apt-key add -
echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.1" \
  >> /etc/apt/sources.list.d/varnish-cache.list
apt-get update
apt-get install varnish

Debian

apt-get install apt-transport-https
curl https://repo.varnish-cache.org/GPG-key.txt | apt-key add -
echo "deb https://repo.varnish-cache.org/debian/ jessie varnish-4.1"\
  >> /etc/apt/sources.list.d/varnish-cache.list
apt-get update
apt-get install varnish

Varnish VCL

Varnish controls and manipulates HTTP requests using Varnish Configuration Language (VCL). The following snippet of VCL removes cookie from incoming requests to /images subdirectory:

sub vcl_recv {
    if (req.url ~ "^/images") {
        unset req.http.cookie;
    }
}

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow