Need some assistance for setting up a subdomain when there is already a webserver

Create an A Record for sub.example.com with the IP address where You host forum

Then in nginx proxy,

use server_name sub.example.com;
And forward all requests to docker container running discourse.