【问题标题】:ERR_ICANN_NAME_COLLISION Using a url instead of ip with hosts fileERR_ICANN_NAME_COLLISION 在主机文件中使用 url 而不是 ip
【发布时间】:2016-07-01 18:48:56
【问题描述】:

我正在尝试使用 laravel homestead 并将“homestead.dev”重定向到“192.168.10.10”。我可以看到使用 IP 的网站,但看不到“homestead.dev”。

我收到此错误:

ERR_ICANN_NAME_COLLISION

ping homestead.dev 以 127.0.53.53 响应。 我也可以用这个访问网站:http://127.0.53.53:8000/

我的家园.yaml:

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: homestead.dev
      to: /home/vagrant/Code/myApp/public

databases:
    - myApp

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

主机文件:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
192.168.10.10   homestead.dev

【问题讨论】:

  • 如果我在主机中使用192.168.10.10 myapp.local,我会收到此错误:ERR_NAME_NOT_RESOLVED

标签: php laravel vagrant homestead hosts


【解决方案1】:

我终于解决了。问题出在主机文件上。这篇文章帮我解决了这个问题:https://serverfault.com/a/452269

更改主机文件时,我不是复制和替换,而是移动和替换它,因此权限发生了变化。

【讨论】:

    【解决方案2】:

    看起来名字冲突,尝试使用不同的名字,例如myapp.dev

    另外,您可以尝试将其添加到您的 hosts 文件中:

    127.0.53.53  homestead.dev
    

    然后在浏览器中使用homestead.dev:8000

    然后尝试重启电脑。

    【讨论】:

    • 尝试了你提到的一切,但仍然是同样的错误:/
    • 如果我在主机中使用192.168.10.10 myapp.local,我会收到此错误:ERR_NAME_NOT_RESOLVED
    • 在那之后您是否重新启动了计算机?你确定你在hosts文件中保存了更改吗?在某些 Windows 版本上,有时看起来您保存了 hosts 文件,但是当您重新打开该文件时,您会看到更改未保存。在浏览器中使用 192.168.10.10 时,是否看到 Laravel 起始页?
    • 是的,我看到使用 192.168.10.10 的起始页。另外我确定它已更改,我关闭了防病毒软件进行更改并重新打开了文件。
    • 好的,你用的是myapp.local还是myapp.local:8000
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-30
    • 2015-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多