It’s same idea, either you are using wordpress or any other framework.
When you have multiple websites point to the same server, all website/http(s) traffic listen to port 80/433, so typically you would have one server listen to these port which would forward the traffic given the hostname/website.
So what does that mean in context of dicsoues,
You can either let discourse nginx server handle traffic redirection (in this case discourse would listen 80/443 see this topic Run other websites on the same machine as Discourse) Or you let discourse listen to different port i.e. 8080 and then ask your server to redirect to it if the request comes from the forum website. Note: in this case it’s better to turn off TLS/SSL from discourse and let your main server handle it.