Part of this setup Nginx, MySql, PHP and WordPress. This part is for configuring Varnish 4.0 on Ubuntu 14.04
On varnish.chris.example.com
Install Varnish 4.0
- Add Varnish’s GPG key
curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | sudo apt-key add -
- Add the source location
echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0" | sudo tee /etc/apt/sources.list.d/varnish-cache.list
- Update local cache
sudo apt-get update
- Perform a version check to make sure that Varnish 4.0 is listed:
sudo apt-get install -s varnish
- Install
sudo apt-get install varnish
Configure Varnish
- Edit the main config file for Varnish
sudo vi /etc/default/varnish
- Change the 6081 to 80 in this block.
BeforeDAEMON_OPTS="-a :6081 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m"
After
DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m"
- Restart Varnish
sudo service varnish restart