Bytenap-Network_color

A quick guide to Install Varnish on cPanel

—-Install Varnish on cPanel—-

As per Google’s report, 53% of site visitors prefer site loading speed less than 3 seconds. The visitors leave the site if it takes more than 3 seconds to load This shows how significantly if your site is an e-commerce Website. The conversion rate will be improved with better website speed. Additionally, to give customers the best user experience, Google has considered site speed as a ranking factor.

Find the best ways to improving website uptime & performance. Install Varnish on cPanel & enjoy a higher conversion rate with a higher ranking.

What is Varnish? Why Install Varnish on cPanel? Tips to Install Varnish on cPanel

Varnish wrote in C language is a free and open-source HTTP accelerator that was developed for boosting up content-heavy and dynamic sites that get huge traffic. So it’s important to install varnish on cPanel to get ultra-high-speed website performance.

Varnish particularly acts as a reverse proxy for your web server. To ease the workload of your CPU the varnish accelerator lies at the front of the server and serves your requests by a factor of about 100 to 300 times.

It responds to HTTP requests from the cache. However, if a request can not be handled then it is rerouted to the backend whereupon an acknowledgement is carried, saved in the cache, and next presented to the customer.

When a reply is cached, it is presented in microseconds, several times quicker than your typical web server.

What is caching and what are its benefits?

The storage of files in memory increases the access speed by making it easily accessible to the client’s demands. A cache is a hardware or software component that stores data so that future requests for that data can be served faster.

Files such as JavaScript files, images are stored in the browser’s cache so you don’t have to download files again and again. Eventually, by doing this the webpages load faster, reduces load speed and bandwidth usage.

Varnish saves a copy of the client request whenever the user visits the webserver for the first time. However, on the next visit varnish will notice that the user made the request earlier and eventually will reply by serving a cached version of the request.

Hence it takes caching to a whole new level and boost speeds up to 300 times. Also, we will provide the best web caching solution for your website.

Varnish can further serve as a load balancer, hence speeds up websites by saving the cache in RAM. This basic capacity to assist requests by caching offers is what improves your site’s execution and agility. 

An extension of its execution abilities, Varnish arrives with a compliant configuration language called VCL. With VCL you can seamlessly configure strategies that determine how incoming inquiries will be managed by the HTTP accelerator.

Varnish supports latest variants of Linux, FreeBSD, OS X as well as Solaris and derivatives of Solaris. Install Varnish on cPanel to get the best user experience.

Some well-known organizations that Install Varnish on cPanel or utilize Varnish on their sites incorporate WikipediaFacebookVimeo, and Reddit.

In this article, we will discuss how to install and set up Varnish 6.2 as a proxy on your cPanel server. Additionally, you can see post on Compress Website Content Using cPanel

Installing Varnish HTTP Cache

Before you start the installation of Varnish you must ensure that your server is running cPanel and Root SSH access provided to the server. Facing HTTP error? Read, Most common HTTP error.

Step 1. Installing EPEL release

The initial step to install varnish on cPanel is to make sure that the EPEL repository is pre-installed. The full form of EPEL is Extra Packages for Enterprise Linux. You can execute the below command for installation.

# yum install -y epel-release

Step 2. Installing Varnish on CentOS 7

Up next, we are performing to install the pygpgme package which will manage GPG signatures as great as yum-utils which is a set of beneficial features. To accomplish this, run the subsequent command. Using Ubuntu? Read, what is the difference between CentOS vs Ubuntu.

# yum install pygpgme yum-utils
Also you can download the latest version of Varnish available for CentOS 7 / RHEL 7 from packagecloud.io.
# wget --content-disposition https://packagecloud.io/varnishcache/varnish60lts/packages/el/7/varnish-6.0.3-1.el7.x86_64.rpm/download.rpm
# rpm -i varnish-6.0.3-1.el7.x86_64.rpm

To verify if varnish is working, run the following command

# systemctl status varnish

Normally, the executable will be found at  /usr/sbin/varnishd path, and arrangement files will be found at /etc/varnish path.

To verify the path of Varnish executable run

# which varnishd

To verify the version of Varnish installed, run

# varnishd -V

Step 3. Configuring Apache webserver to work with Varnish HTTP cache

The concluding step is to configure the Apache webserver to operate with Varnish. By default, Apache runs on port 80.

In this instance, we will change the default httpd port in CentOS 7 to listen to port 8080.

This can easily be achieved using the ‘sed’ command

# sed -i "s/Listen 80/Listen 8080/" /etc/httpd/conf/httpd.conf

The next step is to edit the Varnish environment config file and find the VARNISH_LISTEN_PORT parameter.

# vi /etc/varnish/varnish.params

Change the default value from 6081 to 80

Save and Exit the text editor

Next, set Apache web server as the default back end server. Open the file beneath

/etc/varnish/default.vcl 

Navigate to the backend default section as explained and set the  .host attribute to aim to your server.

Finally, restart the Apache web server as well as Varnish Cache for the changes to take effect

# systemctl restart httpd

# systemctl restart varnish

Step 4:  Testing Varnish Cache

You need to use the curl command as shown below to verify that if varnish is working with the web Apache server.

# curl -I  http://server-ip-address

Additionally, you can use ‘netstat’ command as shown below to verify both your web server and Varnish are running on port 8080 and 80 respectively.

The next step after checking Varnish and Apache web server is running, as usual, you can move on to your cPanel and click on Tweak settings placed on the sidebar.

Now change the default port to 8080 from 80 by clicking on the settings tab.

Conclusion

Hope this tutorial on how to install Varnish on cPanel solves your doubt and querry.

If you don’t want to manually install varnish on cPanel with ByteNAP you can choose Linux VPS hosting that comes with preinstalled Varnish. Likewise opt for SSD VPS Hosting Package that provides supreme hosting at an affordable cost, 100% uptime, and 24/7 local support.

Leave a Comment

Our Experts will help you build the right solution or find the right partner for your needs.

Chat With Us
Scroll to Top

Managed Services

Managed Support

Get fully managed support from Experts
with Pro Active monitoring

Domain

Domain Registration

Register Domain Today

Domain Transfer

Domain Transfer are Quick, Easy &
Affordable

Email

Cloud Mail

Connect & Collaborate with Customers

Google Workspace

Create, Communicate & Collaborate

Security & Backup

SSL Certificate

Secure Your Data & Transactions with SSL Certificate

BitNinja

Secure your Webpages with BitNinja Server

Acronis Cloud Backup

Secure Data Backup for Businesses of All Sizes

Servers

Bare Metal Servers

Solid Performance Bare Metal Server

GPU Servers

Next-Generation GPU Server

Clearance Servers

Stable Clearance Dedicated Server

Cloud VPS

Linux VPS

Get Faster Loading Speed with Linux VPS Hosting

Windows VPS

Leading Windows VPS Hosting

Managed Linux VPS

Powerful Managed Linux VPS Hosting

Managed Windows VPS

Realiable Managed Windows VPS Hosting

Hosting

Linux Hosting

Feature Packed Linux Hosting

Windows Hosting

Stable Windows Hosting Server

Wordpress Hosting

Best & Secure WordPress Hosting

Linux Reseller Hosting

Start Business with Linux Reseller Hosting

Windows Reseller Hosting

White-label Windows Reseller Hosting