Category: Linux

Install Varnish 3 on CentOS 6 or Redhat

For RHEL 6 and compatible distributions, use

rpm --nosignature -i
yum install varnish
varnish -v

* vi /etc/varnish/default.vcl

  • Change IP to listen on specific IP and update VCL as required
backend default {
  .host = "xx.xx.xx.xx";
  .port = "80";

sub vcl_recv{

if (req.request == "GET") {


sub vcl_fetch{
set beresp.ttl = 1w;

  • Change port on varnish to listen to 80 for specific IP
  • Change port on apache to listen to 8080


Varnish config file

  • Restart
service varnish restart
  • Log

Prime the cache

  • Prime cache by running a log for a few days
varnishlog -D -a -w /var/log/varnish.log
  • Then load in log file
varnishreplay -r /var/log/varnish.log
varnishtop -i txurl

Compilation error on a VCL, run from command line to view the error

varnishd -f /etc/varnish/default.vcl -s malloc,1G -T  -a -d

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.