I just changed my moodle installation from online hosting that worked perfectly, albeit extremely slow. I wanted to have a better user experience for customers and ended up switching to a server that ishosted on premises.
I to get the problem that is described here, but in my case I pointed the DNS to my ip. Moodle is set to my public ip and as a result, the domain name does not display.
When I set the DNS to point to my IP, I could change only the A record. The problem is not as described apache based. When I did a reverse lookup on the ip, it reads the reverse from the ISP DNS. This means that moodle relies heavily on the ability to inerpret reverse DNS.
In my case I cannot change the PTR. If you have this ability, change a PTR to point to your domain and it should work fine.
If others have some more suggestions please add, I would love to know a work around to this as well.