Forcing access to Discourse via domain name only

Really sorry I didn’t make myself clear.

Let say my website is hosted on the ip: 123.123.123.123
And this is my domain name: forum.example.com

Right now, visitors can browse the forum by accessing the ip 123.123.123.123

What I want is:

When someone goes to the ip, it will be redirect to forum.example.com

The issue is that I am not able to locate ngnix default file.