Varnish can be a good solution for a faster Apache, Nginx server. It will act like a cache and proxy in your server once installed. Can be a good option for high load server with lot of traffic.
First install the epel respository in your Centos 7 server since it is part of non-standart packages.
[code]yum install -y epel-release[/code]
Update the Centos system with thw following command:
[code]yum -y update[/code]
Install varnish
[code]yum -y install varnish[/code]
Configure Varnish to run at server start up
[code]systemctl enable varnish[/code]
Start Varnish
[code]systemctl start varnish[/code]
In order to be sure the service started successfully please type the following command
[code]systemctl status varnish[/code]
Check the Varnish version installed in your server
[code]varnishd -V
[/code]
After checked successfully please check the following file for the basic configuration
[code]nano /etc/varnish/default.vcl[/code]
Edit the following lines into default.vcl
[code]change VARNISH_LISTEN_POR to 80[/code]
Change the following lines as followed
[code]backend default {
.host = “127.0.0.1”;
.port = “8080”;
} [/code]
change the apache configuration as well to work with Varnish
[code]nano /etc/httpd/conf/httpd.conf[/code]
Change listen port from 80 to 8080
[code]Listen 80
80[/code]
Restart Apache and Varnish
[code]sudo apachectl restart
systemctl restart varnish[/code]
If you will open your ip from the browser and check the apache log after you will see logs like this:
[code]HTTP/1.1 200 OK
Date: Wed, 04 Nov 2015 10:21:07 GMT
Server: Apache/2.4.6 (CentOS)
Last-Modified: Fri, 02 Oct 2015 10:36:53 GMT
ETag: “6c-5211cdbf61c14”
Content-Length: 108
Content-Type: text/html; charset=UTF-8
X-Varnish: 32770
Age: 0
Via: 1.1 varnish-v4
Connection: keep-alive[/code]