The beautiful thing about Cloudways is that it moves the system administration busy work involved with deploying and hosting a web site into a relatively simple web interface. Yet you still have enough of the linux command line to feel like you’re in the driver’s seat. But as they say, there’s always a cost for convenience. Or, in this case, a compromise.
I recently moved some personal web sites from Digital Ocean to a single Digital Ocean-backed server at Cloudways. In fact, the site you’re on right now uses a Cloudways WordPress application. But, it 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 are updated every 5 minutes from servers at my home.
After getting the weather data and sky cams working at Cloudways, I noticed that the caching seemed way too sticky. The weather page and camera images would not update automatically from the last time you viewed them, even after several days.
First I disabled Varnish caching for the directories in question, but that didn’t help. Then I tried a few cache-related Apache directives in .htaccess files, and those didn’t help either. The directives fixed the response headers for the directories themselves, but not for the files. All file requests were set to expire after 30 days, period.
The problem was that I didn’t fully understand the hosting environment. I assumed that Apache was serving everything. Instead, it’s a hybrid of Apache and Nginx. Apache serves the dynamic and Nginx handles the static.
Eventually I found the “Static Cache Expiry” setting available at the server level, and only at the server level. There’s no way to control it per application (i.e., per site), and since Nginx doesn’t have an .htaccess equivalent, there’s no way to override it per directory. Certainly there must be some way to override it — but I confirmed with Cloudways support that the single setting applies to the entire server and that there’s no way to change it down the line.
The idea of setting static caching to 5 minutes for every directory, on every site, simply to accommodate two isolated situations is a bit rough. I could always move the static stuff to a regular ol’ LAMP server at Digital Ocean or Vultr, but I’d really like to keep everything together.
It’s too bad Cloudways doesn’t offer some sort of alternative, like the ability to serve static content using Apache with Google PageSpeed. Or something. Anything.