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#
Version | Release Date |
---|---|
5.1.2 | 2017-04-07 |
5.1.1 | 2017-03-16 |
5.0 | 2016-09-15 |
4.1.5 | 2016-02-09 |
4.0.4 | 2016-11-30 |
3.0.7 | 2015-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;
}
}