I recently migrated a WordPress 4.7 site to a new VPS and thought I’d throw Varnish in front of it and run the whole thing under Caddy. I’m extremely happy with the final solution and it’s quirky enough that I figured it’d be worth documenting and sharing with others. There’s a lot of information in this gist (it should probably be a blog post and/or full-blown repo) but hopefully it helps the next poor soul trying to figure out how to do it!
Let me know here or in the gist comments if you have any questions or feedback. Thanks!
@Nirjhor It doesn’t look like you’re following my gist at all, so I guess my first suggestion would be to read through it and follow the instructions. I just updated it for Caddy 0.10. Let me know if you’re still stuck.
Oh yes. YMMV depending on the complexity of your WordPress site, the underlying hardware, database, benchmark configuration, etc., and it’s hard to get an apples-to-apples comparison without completely reconfiguring everything, but on a $10/mo 2GB Linode VPS*, it’s approximately 550 req/sec w/ (https**) vs. 25 req/sec w/o (http***) to retrieve the home page of my blog, or a speedup of 22X.
Cheers @mwpastore looks good. Definitely will test this out myself (CentOS 7 though). Wonder how much difference would there would be comparing the usual Varnish recommended SSL proxy (Hitch) for terminating HTTPS connections to Varnish ? Caddy is definitely easier to setup that having another piece of the puzzle added for Hitch install/configuration and Caddy handles the SSL certs
Oh, absolutely. There’s a million pieces you can plug in and change around: HAProxy, Hitch, Pound, etc. You can do the whole thing in Nginx, or just SSL termination, or just caching and compression, or just for serving the static content and FastCGI. You can use Squid instead of Varnish. And so forth and so on.
My go-to is usually HAProxy+Varnish. Caddy was attractive to me because of its simplicity and certificate management features, and its feature set seemed to complement Varnish’s well. But it’s by no means the end-all, be-all solution. Interestingly, since I wrote this gist, Caddy has added its own caching plugin, which I need to find time to play with.
I have no doubt it’d show the same results as your benchmarks. I had some issues with the http2 feature when I tried it in this configuration with Varnish 5.0 and never revisited it. Now I have good reason not to!
What I really want is Caddy to support PROXY protocol up- and down-stream.
I re-ran this benchmark with the Accept-Encoding: gzip header (this makes more sense because Varnish is serving the gzipped content straight from memory without gunzipping it as it would for an older client) and the number is closer to 900 req/sec.