I have set up my Discourse community with Digital Ocean, but the domain name is “naked”, at just https://example.com. I would like to add the www., but not quite sure what I am doing when it comes to DNS settings!
At the moment I have an ‘A’ record pointing to the IP and a ‘CNAME’ record with www. pointing to this. Is it as simple as changing the www. to an ‘A’ record and ditching the CNAME? Or perhaps I have them both as ‘A’ records? Or perhaps there is a simple setting in Discourse itself which selects how the domain will appear?
It is funny, I have a normal wix site which appears to be the same configuration with a naked A record and www. CNAME which shows up as www. in the browser - so I am not sure what it is that makes it show like that.
I promise I have tried to further educate myself on DNS, but am totally confused!
Any help on how to add the www. is much appreciated!
Thank you very much for this - I have successfully got it working at the www. by re-running the discourse-setup script as in your article, but now the naked domain no longer works! Is there any way I can make the naked domain work as well - or at least automatically fill in the www.?
So I now have A record linking naked domain to IP address
CNAME record linking www to naked domain
Thank you for this - I have read through both options, but just wondered, why could I not just use a simple 301 redirect to redirect from naked domain to www.? Is this worth a try or am I breaking DNS laws?
Both of those methods provide a letsencrypt certificate for the second (sub)domain. Adding the extra info to your app.yml covers both domain addresses in the same certificate, and forcewww.com has some special magic that does it on the fly so you don’t have to worry about it:
O.K sounds as if I should just use forcewww. Can I just confirm (sorry I am very out of my depth) - they are asking me to set up the www as an A record to my server IP, and the naked domain as an A record to the IP address they give? So no CNAMES?
What I have now:
A record pointing naked domain to server IP
CNAME record pointing www to naked domain
Proposed change using ForceWWW
A record pointing naked domain to forcewww IP
A record pointing www to my server IP
Unfortunately - this has somehow broken the emailing system - the site is not sending any emails through mailgun. Might this be because of the forcewww - as the host is now through their server? Or do I need to update mailgun to say www? Lord give me strength.