How to Install Varnish 4 on CentOS 7

Cpanel/Whm License $3/mo Plesk License $10/mo Cloudlinux License $5/mo

Varnish is a proxy and cache, or HTTP accelerator, designed to improve performance for busy, dynamic websites. By redirecting traffic to static pages whenever possible, varnish reduces the number of dynamic page calls, thus reducing the load.

Pre-Flight Check
  • These instructions are intended specifically for installing the Varnish on CentOS 7.
  • I’ll be working from a sxi.io Web Self Managed CentOS 7 server, and I’ll be logged in as root.

Step 1: Add the EPEL Repository

Varnish is part of Extra Packages for Enterprise Linux (EPEL), which is a community repository of non-standard packages for the RHEL distribution. First, we’ll install the EPEL repository, for directions see How to enable EPEL repository?

Step 2: Install Varnish

First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.

yum -y update

At this point, installing Varnish is as simple as running just one command:

yum -y install varnish

Step 3: Start Varnish

To configure varnish to start at boot, run the following command:

systemctl enable varnish

To start varnish, run the following command as root:

systemctl start varnish

To check the status of varnish, run the following command as root:

systemctl status varnish

Check the version of Varnish that is running:

varnishd -V

Varnish is configured to listen on port 6081 by default. It expects your web server to be local, or on the same serve,r and listening on port 8080.

Step 4: Configuration File Locations

A basic and default configuration file can be found at:

/etc/varnish/default.vcl

An example configuration can be found in example.vcl:

/usr/share/doc/varnish-4.0.1/example.vcl

For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor

To view or edit example.vcl:

vim /usr/share/doc/varnish-4.0.1/example.vcl

Related posts

Tokyo Stock Exchange Operator Joins NRI Blockchain Trials

SXI ADMIN

BIS Report: DLT ‘Promising’ But ‘A Long Way Off’

SXI ADMIN

Jamie Dimon Regrets Calling Bitcoin a Fraud

SXI ADMIN

Game of Bluffs? With UAHF, Bitcoin Scaling Becomes Digital ‘Missile Crisis’

SXI ADMIN

South Carolina Ends Cease & Desist Orders Against Crypto Startups

SXI ADMIN

BitConnect Lawsuits Are Piling Up In Florida

SXI ADMIN

Bitcoin Mining Fraud Lawsuit Moves Forward in New Jersey

SXI ADMIN

Linux Install Google Chrome Browser [ Ubuntu, Suse, Debian, Fedora ]

SXI ADMIN

Ethereum’s Constantinople Hard Fork Is Being Delayed Until 2019

SXI ADMIN

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More