Wordpress website with caddy and varnish error

(Oliver Russell) #1

I am running a WordPress 5.0 website with Caddy. Since my site was loading slow, it was 8s load time, I tried to install and configure Redis and Varnish to improve it. While I was able to configure redis successfully, I am stuck at varnish part. When I try to configure varnish cache using this tutorial, I am getting 503 error. I haven’t tried any fix yet. I have email the article author for a solution. But I am also asking here for any quick support.

(Matthew Fay) #2

G’day @nomine, welcome to the Caddy community.

Dunno about Varnish, and I’m not sure exactly what the state of things is over on your VPS right now. But putting Varnish in the mix can be a bit complicated, because, to lift a diagram from the article…

Caddy serves as both the “FE Proxy SSL Offload” step (via Automatic HTTPS), requiring it to be in front of Varnish, but also as the HTTP Server itself if you’re running WordPress on it, which means it’s also the backend behind Varnish.

That means you’d need two Caddy instances, or at least two sites configured in your Caddyfile - the frontend, passing traffic to Varnish, and the backend that listens for Varnish requests and passes them to PHP.

That’s something that the article doesn’t really touch on. It just demos Varnish using nginx on port 80, no HTTPS.

Other than that, I’m not sure I can debug Varnish itself if you’ve got it listening in front and it’s not working as expected. I’d probably follow the instructions again from scratch, get it working with nginx first, then worry about dropping Caddy in as a replacement for the frontend / backend layers.

1 Like