我的 /etc/hosts 文件如下所示:
127.0.0.1 localhost
10.20.7.67 testsitealpha.dev
othersite.dev testsitebeta.dev
Run Code Online (Sandbox Code Playgroud)
前两个工作。最后一个没有。为什么不?我如何使它工作?我这样做的原因是因为我有一个测试服务器(othersite.com),它在本地网络上,但它的 ip 可能会有所不同。例如,一天 10.20.7.98,另一天 10.20.7.35,等等。
那么,如何让我的系统始终将 testsitebeta.dev 解析为与 othersite.dev 相同的 IP?