Compiling the HTTP Substitutions Filter module for NGINX on CentOS 7

I use NGINX for various things, including one niche case, where I rewrite and replace strings before presenting them to the user. I do this using the HTTP substitutions filter module. The readily-compiled module to accomplish this is included with the paid NGINX Plus, but is also available to DIY compile if you have the ability.

If you're just looking for precompiled .so files you can use with NGINX on CentOS 7 available from the nginx.org repository, see the end of this post.

A while ago I took the time to work out how to compile this for updates; the CentOS box I run NGINX on uses yum packages for updates, but then the subs filter module stops working. So, after half an hour or so of tinkering, quiet swearing, obtaining of additional packages, tweaking commandlines etc... I have a working oneliner to make an NGINX build which will also compile a suitable ngx_http_subs_filter_module.so file. 

To compile this dynamic module you generally need to build with the same switches used for the packaged build. So, first step was to find out how it was compiled:

See how to check your compile flags, and how to build from source
I