Linux

伺服器上的主機名問題

  • October 5, 2013

來自 WHM/CPANEL 的電子郵件

Your hostname (HOSTIT) could not be resolved to an IP address.
This means that /etc/hosts is not set up correctly, and/or there is
no dns entry for HOSTIT. Please be sure that the contents of
/etc/hosts are configured correctly, and also that there is a
correct 'A' entry for the domain in the zone file.

Some or all of these problems can be caused by /etc/resolv.conf
being setup incorrectly. Please check that file if you believe
everything else is correct.

You may be able to automatically correct this problem by using the
'Add an A entry for your hostname' option under 'Dns Functions' in
your Web Host Manager. 

主機文件:

cat /etc/hosts
127.0.0.1               localhost localhost.localdomain localhost4 localhost4.localdomain4
::1             localhost localhost.localdomain localhost6 localhost6.localdomain6
18.14.16.26           HOSTIT HOSTIT.co sqwb1 sqwb1.HOSTIT.co

和 DNS:我可以對 HOSTIT.co 和 sqwb1.HOSTIT.co 進行 ping 操作,它們會轉到正確的 IP

這可能是什麼原因造成的?

您需要使用 FQDN 作為 CPanel 的主機名:

您的主機名是您的物理 Web 伺服器在 Internet 上為人所知的名稱。選擇一個不會用於 cPanel 帳戶的主機名很重要,它是社會可接受的(因為它將出現在郵件標題中),並且是一個完全限定的域名(FQDN - 這將包含 2 個點,’.’)

FQDN 也必須用小寫字母書寫。這些要求可以在主機名首頁面的說明標題下查看。

來源:http ://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/HOstname

引用自:https://serverfault.com/questions/543945