Small blog about system administration.

HOWTO: install varnish cache on cpanel

Varnish Cache is a web accelerator, sometimes referred to as a HTTP accelerator or a reverse HTTP proxy, that will significantly enhance your web performance.
Varnish speeds up a website by storing a copy of the page served by the web server the first time a user visits that page. The next time a user requests the same page, Varnish will serve the copy instead of requesting the page from the web server.
This means that your web server needs to handle less traffic and your website’s performance and scalability go through the roof. In fact Varnish Cache is often the single most critical piece of software in a web based business.
This opensource w3tools will remove previous varnish installation.  Please backup your apache configuration file httpd.conf before proceed.
# cd /usr/local/src

# wget "" -O /usr/local/src/

# chmod +x

# ./
Once installation completed, Edit configuration file and change listening port to 80
vi /etc/sysconfig/varnish
Edit proxy settings in varnish
vi /etc/varnish/default.vcl or check with /usr/local/varnish/etc/varnish/vhost.vcl
backend default {
.host = "";
.port = "82";

sub vcl_recv {
if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {

# strip the cookie before the image is inserted into cache.

sub vcl_fetch {
if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
unset beresp.http.set-cookie;
Enable chkconfig  and restart varnish service
chkconfig varnish on
service varnish start
Thats all… You can monitor varnish cache through this monitoring tool.

No comments :

Post a Comment