Any XYZ domain which points to my Digital Ocean droplet IP, it redirects to my forum. This way it has created a lot of uknown 404 logs and affecting link profile.
Last time this was brought up the easiest solution was to enable SSL, that will cause the wrong domains to either redirect to the correct one, or show an SSL error:
If thats not an option you can use a pups template to add that 403 block into the Discourse nginx config.
Then adding it to the Discourse nginx config would be the next easiest thing. Using a new pups template would be the best way, to save you needing to re-apply the change every rebuild.
You could try… Make a new file at /var/discourse/templates/web.403.yml, with the following contents:
I should add…
If you want to test that config you can use ./launcher enter app to get a terminal up in the container, then edit /etc/nginx/conf.d/discourse.conf there (vi should be installed, or install something more familiar), and you can run service nginx reload to apply the config change.
If that all runs well, then my above post will make the change more permenant (by automatically making the change to the file every rebuild)