Setting up Varnish 3x on a Drupal 7 site running a CentOS server

Submitted by Brian on February 6, 2014 - 2:56pm
simple guide to getting varnish running on your Drupal site

Varnish is an extremely powerful reverse proxy tool for caching your sites anonymous traffic. That being said there are some steps that you need to take to get it set up and I found it quite hard to find a guide on how to do this so I figured I would post it here.

First step is add the Varnish repo:sudo rpm -Uvh http://repo.varnish-cache.org/redhat/varnish-3.0/el6/noarch/varnish-rele...

then install it! sudo yum install varnish

Next check to see if varnish is in there: sudo chkconfig varnish on

now you will need to edit your VCL file. by default Varnish is set to use 6082 port, so for this case I recommend doing that: sudo vi /etc/varnish/default.vcl and change the port from 80 (default) to 8080 (this is the default port that varnish runs on).

fire up the service! sudo service varnish start

next you will need to get your varnish control key (Copy your code): sudo cat /etc/varnish/secret

Now you will need to download and install the drupal varnish module:drush dl varnish, drush en varnish -y

The last step is to go in your varnish settings (/admin/config/development/varnish) and set the varnish control key that you copied already, select version 3x and you should be all set!