New install nginx errors

I’m trying to set up on a clean install on Ubuntu 20.04.3 LTS

This is on a virtual machine inside a corporate network, the DNS A records point to the firewall that will use host headers to direct to the server, the internal IP address is different to the external.

Currently, for set up, there is an internal network DNS entry that is resolved internally, that the server can resolve and other machines can access on the network.

I have installed a wildcard certificate as instructed here: How to install SSL certificate in Discourse - support - Discourse Meta which works without issue.

I have installed using the 30 minute quick start guide.

The problem

The forum functions correctly when disabling SSL. However with SSL enabled nginx errors with invalid variable name in /etc/nginx/conf.d/discourse.conf:46 this clearly relates to the the forum host variable and connections are impossible.

I have tried creating a nginx template with the url hardcoded, and this does then load the site, however I then get mixed resource errors and none of the JavaScript loads as it violates the CSP:

because it violates the following Content Security Policy directive: "script-src https://www.example.com/logs/ ...

I can disable CSP and things broadly work (though there are still references to the manifest at example.com), but I’d rather not and it doesn’t fix the resources at the incorrect address

Any advice would be very much appreciated!