Setting up page caching for Sinatra/Puma on Nginx

Ok, so… I have set up a droplet here in DigitalOcean with Ubuntu 18.04 for a Ruby/Sinatra website, using Puma + Nginx + SSL (via Let’s encrypt).

Everything works fine.

However, since most (but not all) of my Sinatra-generated content is actually static - meaning: once it’s generated, it’ll most likely never change, I want to set up page caching (if that’s what it’s called) via Nginx.

Basically, if a page has already been generated (and cached), no need to go to Sinatra at all - just send the pre-generated page instantly. That’s my idea.

How would I achieve this?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!