【问题标题】:/etc/hosts not read by browser?/etc/hosts 没有被浏览器读取?
【发布时间】:2018-04-03 14:19:16
【问题描述】:

我使用的是 Linux Mint 18.1 Serena。就在上周,我的机器开始出现异常。我的 /etc/hosts 中有几个条目指向一些本地网站进行开发。 由于一个不明显的原因,上周我的浏览器停止解析这些域,但是使用 curl 我确实得到了有效的响应。我尝试重新启动一切,但没有成功。

这是我的 /etc/hosts 和 /etc/nsswitch.conf 的内容

127.0.0.1       localhost
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

172.27.0.4 dp-relaunch-coreshop.dp.dev
172.29.0.4 foodexplorer-coreshop.dp.dev


# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed,     try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

我希望有人可以帮助我。

【问题讨论】:

  • 所有浏览器都会出现这种情况吗?像 Firefox、Chromium 等?

标签: linux dns linux-mint


【解决方案1】:

我可以看到您使用的是 Unix 系统,根据经验,我发现 Chrome 忽略了系统主机字段,尽管我使用的是 Windows。

确保运行您的浏览器的用户有权读取/etc/host/etc/nsswitch.conf 文件并查看是否有效。

【讨论】:

    【解决方案2】:

    最近更新的浏览器似乎与以*.dev 结尾的本地域存在问题,尝试将它们更改为*.local 并重试。虽然我不知道为什么,但这为我解决了这个问题

    【讨论】:

      猜你喜欢
      • 2016-08-27
      • 1970-01-01
      • 1970-01-01
      • 2013-10-06
      • 2015-08-19
      • 1970-01-01
      • 2018-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多