Install varnish on cPanel

install varnish
install varnish

Install varnish on cPanel

This post helps you to install Varnish on cPanel server. Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 – 1000x, depending on your architecture.

How to install varnish cache on cPanel

Please change the Apache non-SSL IP/port to 8080 or anything else. You can do it via WHM -> Tweak Settings -> Apache non-SSL IP/port.

Then you need to install Varnish repository:

rpm -ivh varnish-release-3.0-1.el6.noarch.rpm

I am installing varnish repository for EL6. You can find the EL5 and EL7 repositories from the following links.

[button color=”blue” size=”small” link=”” icon=”” target=”true”]EL5 REPOSITORY[/button] [button color=”blue” size=”small” link=”” icon=”” target=”true”]EL7 REPOSITORY[/button]

Once you enabled the repository, you can install varnish using yum command.

yum install varnish

Then you need to edit the varnish configuration file to change the listen port to 80.

vim /etc/sysconfig/varnish

and edit the following field.


Next is to edit the varnish basic VCL configuration file.

vi /etc/varnish/default.vcl

Change the .host field with your server IP address and .port field with the port 8080 (Apache non-SSL port).

backend default {
.host = "Your_IP_Address";
.port = "8080";

Now start Varnish service on your server:

chkconfig varnish on
/etc/init.d/varnish restart

Also, you can check if the port 80 is listing varnish by netstat command.

netstat -plan | grep :80

One of the key features of Varnish Cache, in addition to its performance, is the flexibility of its configuration language, VCL. VCL enables you to write policies on how incoming requests should be handled.

That’s it!!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at