What to use for a hostname on a dedicated Linux server?
I'm not sure I agree with the advice to not configure primary_hostname
explicitly. Of course it's a nice idea in principle to only configure the system's hostname in one place and then have it percolate through the rest of the system, but the 2019 reality of sending email is that you can't just change your outgoing FQDN and expect things to keep working. Ideally, the reverse-DNS of your outgoing IP-address and your HELO name will be the same and consistently resolve back to the IP-address. So it is essential to have the right IP-address configured in the external DNS for your domain. If you know your server will always have reliable access to this external DNS then there's no reason to put any of that in /etc/hosts
and I would just stick with 127.0.0.1 localhost
there.
For Exim I would personally recommend explicit configuration of primary_hostname
. In addition I would draw your attention to the qualify_domain
setting, which defaults to the value of primary_hostname
but you may want to set explicitly to just your domain name as well.