Installing Varnish into your cpanel account is easy and straight forward. Follow this how-to and it should take you less than 5 minutes to have Varnish up, running and serving website in your server.

The following command will work on a CentOS system. If you are running your server into another Linux distribution follow this link http://www.varnish-cache.org/docs/4.0/installation/install.html

rpm -ivh http://dl.fedoraproject.org/pub/epel/6Server/x86_64/epel-release-6-8.noarch.rpm

Install…

yum install -y varnish

Once the installation completes, we will configure Varnish to listen on port 80. Edit the file /etc/sysconfig/varnish using your preferred editor.

nano /etc/sysconfig/varnish

Search and change…

VARNISH_LISTEN_PORT=80
mv /etc/varnish/default.vcl /etc/varnish/default_bak.vcl

Create and edit a new default.vcl file…

nano /etc/varnish/default.vcl

Paste the following code within this file and save it.

vcl 4.0;
backend default {
.host = "YOUR_SERVER_IP";
.port = "8080";
}

Remember to change YOUR_SERVER_IP with the IP address of your server.

There is a lot of extra configuration available online. For a complete guide go to Varnish 4.0Guide

In case you get permissions error from gcc and ld just run the following commands…

chmod 755 /usr/bin/gcc
chmod 755 /usr/bin/ld

Login to your WHM as root, click on Tweak Settings from the sidebar, go to the system tab and change the Apache Non-SSL port to 8080

Apache non-SSL IP/port” from “0.0.0.0:80” to “0.0.0.0:8080.

And lastly check the configurations set within the default.vcl is correct.

chkconfig varnish on

Restart services…

/etc/init.d/https restart
/etc/init.d/varnish start

All done you can check your varnish stats by running the following command.

varnishstat

Also you can check if the configuration you just did is running as expected by running,

netstat -tulpn

There you should see something like:

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      5001/varnishd       
tcp        0      0 0.0.0.0:8080                0.0.0.0:*                   LISTEN      2573/httpd  

Well that’s all. Happy caching!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Cheap Oakley Sunglasses Fifa Coins Fifa Coins Cheap Fifa Coins buy cheap fifa coins buy fifa coins cheap fifa coins fifa coins sale Fifa Coins cheap fifa coins sale fifa coins for sale cheap fifa coins price