how to setup 'hostname fqdn' on a VPS
I recently bought a vps server with DirectAdmin installed on it. everything works fine except I can't send emails. the DirectAdmin's messaging system issued this notification:
Cannot find your hostname using the command '/bin/hostname --fqdn'. Please check this >command to ensure it works properly. If you get the error: hostname: Name or service not known
Check your /etc/resolv.conf and try setting it to use 127.0.0.1Unable to resolve your >hostname, . This will cause major issues when sending emai开发者_JS百科l.
Solution:
Create an A record for your hostname (.) in your DNS control panel. Point the hostname to >your server's main IP address. Also check /etc/hosts to ensure that the server ip is >correctly set.
my /etc/hosts contains this:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
127.0.1.1 srvubu100.screweb.com srvubu100 ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
178.162.145.82 srv771.screweb.com
178.162.145.82 srv771.bitcommand.com
178.162.145.82 server1.novinhost.net
You should set a hostname using the script /usr/local/directadmin/scripts/hostname.sh
like this:
/usr/local/directadmin/scripts/hostname.sh host.yourdomain.com
Then you should edit your /etc/hosts
file and leave it like this:
127.0.0.1 localhost.localdomain localhost
::1 localhost ip6-localhost
178.162.145.82 host.yourdomain.com
Then restart your exim (service exim restart
) and it should work ok.
精彩评论