I moved most of my personal web sites from several Ubuntu servers at Digital Ocean to a Digital Ocean backed server at Cloudways. Cloudways abstracts most of the system admin busywork and makes it easy to set up new sites quickly while still providing enough of the command line environment to feel like you have control.
This site you’re on right now uses a Cloudways WordPress application, but also hosts some static content that doesn’t live within the WordPress environment itself. Namely, the sky cams you see in the right sidebar and the weather station data page. Both things are updated from servers at my home every 5 minutes.
After moving the site and getting these two items working, I noticed that the caching for them was way too sticky. When loading the weather page or viewing the sky cams, they wouldn’t update automatically from the last time you viewed them, even after several days.
My first thought was to disable Varnish caching for these directories, but that didn’t help. I tried several different Apache directives to control caching-related headers and added them to the .htaccess files — that didn’t help either. They affected the response headers for loading a directory, but any call to a file was always set to a 30 day cache expiration.
The main problem was that I didn’t fully understand the environment and just assumed it’s all being served by Apache. It’s actually using an Apache/Nginx hybrid, with Nginx serving the static content. Eventually I found a “Static Cache Expiry” setting available at the server level, and only at the server level. There’s no way to control it per application (site), and since Nginx doesn’t have an .htaccess file equivalent, there’s no way to override it per directory. That seems to be a little lacking in granularity — certainly there must be some way to override it — but I confirmed with Cloudways support that the single setting applies to the entire server with no way to change it.
Ultimately I’m not thrilled about having to set static content caching to 5 minutes for every directory on every site on the server, but it all still seems snappy enough for now. The static stuff could be hosted on other Ubuntu servers I still have at Digital Ocean, but it would be nice to keep it all together. We’ll see.