# Using a Varnish Cache Varnish is a layer that sits between your web server and your backend application - it does something similar to NGINX caching, but tends to be optimized for speed over all else. To set up a Varnish cache, first you'll need to install Varnish. This will vary by distribution, and since this is a rather advanced guide, no copy-paste instructions are provided. It's probably in your distribution's package manager, though. `apt-get install varnish` and so on. Once you have Varnish installed, you'll need to configure it to work with Akkoma. Copy the configuration file to the Varnish configuration directory: cp installation/akkoma.vcl /etc/varnish/akkoma.vcl You may want to check if Varnish added a `default.vcl` file to the same directory, if so, you can just remove it without issue. Then boot up Varnish, probably `systemctl start varnish` or `service varnish start`. Now you should be able to `curl -D- localhost:6081` and see a bunch of Akkoma JavaScript. Once that's out of the way, we can point our webserver at Varnish. This === "NGINX" upstream phoenix { server 127.0.0.1:6081 max_fails=5 fail_timeout=60s; } === "Caddy" reverse_proxy 127.0.0.1:6081 Now hopefully it all works If you get a HTTPS redirect loop, you may need to remove this part of the VCL ```vcl if (std.port(server.ip) != 443) { set req.http.X-Forwarded-Proto = "http"; set req.http.x-redir = "https://" + req.http.host + req.url; return (synth(750, "")); } else { set req.http.X-Forwarded-Proto = "https"; } ``` This will allow your webserver alone to handle redirects.