在 Linux 中, 往往解析一个域名时, 先会找/etc/hosts 档案, 若/etc/hosts 档案没有对应, 才会去找 DNS(/etc/resolv.conf).
那么这个顺序是由什么决定的呢? 是否可以更改顺序呢?
当然有, 在/etc/nsswitch.conf 这个档案中定义:
#hosts:     db files nisplus nis dns
hosts:      files dns
这个显示, 你的 WordPress 主机就会先去找/etc/hosts 档案, 然后才去找 DNS.
 
若想先从 DNS(/etc/resolv.conf) 档案开始解析, 则可以如下修改:
#hosts:     db files nisplus nis dns
hosts:      dns files
这样, 你的 WordPress 主机就会先去找 DNS, 再去找 hosts 了.