Install Varnish on CentOS/RedHat/SL 5 or 6

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. It is installed in front of the web application and it speeds up the web application significantly.

Since varnish is not available in CentOS repo, you have to add the EPEL repo. However Varnish suggests you to add its own repo to always get the latest version.

rpm –nosignature -i

The –no-signature is only needed on initial installation, since the Varnish GPG key is not yet in the yum keyring

Now lets install varnish

# yum install varnish

Make sure it can handle server reboots 🙂

# chkconfig varnish on

Lets change some parameters to suit our enviornment.

# vi /etc/varnish/default.vcl

# This is a basic VCL configuration file for varnish. See the vcl(7)

# man page for details on VCL syntax and semantics.


# Default backend definition. Set this to point to your content

# server.


backend default {

.host = ""; //here goes your application server ip address

.port = "80"; //the port number accepting web requests


Finally lets start varnish

# service varnish start

This is a very basic setup, you may tweak it a little more according to your requirement.