-
Notifications
You must be signed in to change notification settings - Fork 0
Setting Up Varnish In Linux
This wiki is no longer maintained and should not be used. Read the Event Store docs at docs.geteventstore.com.
The latest version of the page you are currently viewing is available here.
This document provides a brief guide on how to install the Event Store with varnish reverse proxy in a linux environment. We will not be going into a lot of detail on how to properly configure varnish for your requirements much of that information can be found on their website https://www.varnish-cache.org/trac/wiki/Introduction
The Event Store makes heavy use of caching for many items if not being secured. A reverse proxy can dramatically speed up the Event Store.
A reverse proxy can also be used to limit access to the Event Store without breaking http caching (authenticate to the proxy not to the Event Store itself). Since the Event Store is running http only on the loopback adapter users must enter through the reverse proxy to reach the Event Store. https://gist.github.com/benclark/2695148 contains a more configured varnish config that includes basic authentication as well as some other niceties such as putting headers on for hits/misses).
The first thing that we will need to do is to install varnish
sudo curl http://repo.varnish-cache.org/debian/GPG-key.txt | sudo apt-key add -
echo "deb http://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install varnishThe next thing to do is to configure varnish.
sudo vi /etc/default/varnish
Edit the are that looks like
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
Replace the port with the port you want to run on. Then
sudo vi /etc/varnish/default.vcl
Set it to:
backend default {
.host = "127.0.0.1";
.port = "2114";
}Now you would sudo service varnish restart to restart varnish and you should be up and running with a reverse proxy. If you want to check out the status of varnish you can check with varnishstat from the command line.