Install Varnish with Apache Server

Posted: March 24, 2017 in Linux

Install apt-transport-https

# apt-get install apt-transport-https
clip_image002

Install Curl

# apt-get install curl
clip_image004

Add GPG Key Varnish

curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | apt-key add – clip_image006

Add Repository Varnish

# echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.1" >> /etc/apt/sources.list.d/varnish-cache.list clip_image008

# apt-get update 

 clip_image010

Install Varnish

# apt-get install varnish <–!more–>
clip_image012

Configuration Varnish

# nano /etc/default/varnish
Change Port from 6081 to 80
clip_image002[5]
# nano /etc/varnish/default.vcl
I set port 88 because port 80 is already exist (used by varnish)

clip_image004[5]

Configuration Apache

Edit port apache from 80 to 88 on /etc/apache2/ports.conf
clip_image006[6]
Change virtual Host from 80 to 88 on /etc/apache/sites-enabled/000-default.conf
clip_image008[5]
Restart Services
# service apache2 restart
# service varnish restart
clip_image009

Testing Varnish running

# curl –I  http://aafikry.web.id
clip_image011
# varnishstat

image

CMIIW, Thanks Smile

Leave a Reply

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