Nginx directives

I’ve spent a good bit of time digging through the forums, I’ve seen lots of requests but no answers around this. Or maybe I’m missing a simple explanation.
I need to add a good number of custom directives to nginx, a basic template form or template config file.

I need to add fastcgi_cache_path before each server directive in nginx as well as set expire headers, paths to exclude from caching etc.

My perl is a bit rusty, haven’t used perl in many many years but I’ve been doing this in ansible with jinja templates and it’s breeze. Is there a way to add this easily? Many of the params would be the same for all hosts except the fastcgi_cache_path which would be set to the path for each virtual server so cache could be managed separately for each (I’ll write a wordpress module to handle this).

Server Templates allows changing any of the config file bits that Virtualmin creates.

Yes and no. It’ll add directives within the server block, but the fastcgi_cache_path needs to be outside the server block. The path would also need to be created for instance /home/username/cache so it also needs to grab the relevant username

an example entry that I use on other servers

fastcgi_cache_path /web/html/ levels=1:2 keys_zone=domanname:100m max_size=1g inactive=10m use_temp_path=off;

@joshj71 from your posts you seems to know what to do - problem solved no? I would join to @Joe answer on this… really nothing else need to be done about it.

Well I wouldn’t call it solved. Virtualmin doesn’t do what I need it to, not just this one issue, I have several issues with the product. So I’ve decided to drop virtualmin and go another route.