【问题标题】:Homestead doesn't work宅基地不工作
【发布时间】:2017-12-31 03:50:15
【问题描述】:

我通过命令“vagrant up”运行了我的虚拟机,一切正常。 "vagrant ssh" 运行良好,ifconfig 的输出是:

vagrant@precise32:~$ ifconfig
      eth0      Link encap:Ethernet  HWaddr 08:00:27:12:96:98
                inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
                inet6 addr: fe80::a00:27ff:fe12:9698/64 Scope:Link
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:583 errors:0 dropped:0 overruns:0 frame:0
                TX packets:420 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:65606 (65.6 KB)  TX bytes:56229 (56.2 KB)

      lo        Link encap:Local Loopback
                inet addr:127.0.0.1  Mask:255.0.0.0
                inet6 addr: ::1/128 Scope:Host
                UP LOOPBACK RUNNING  MTU:16436  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

我的 Homestead.yaml 是:

ip: 192.168.10.10
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:/Users/franc/.ssh/id_rsa.pub
keys:
    - C:/Users/franc/.ssh/id_rsa
folders:
    -
        map: C:/Users/franc/Websites/Prova
        to: /home/vagrant/Code/prova
sites:
    -
        map: Prova.app
        to: /home/vagrant/Code/prova/public
databases:
    - homestead
name: prova
hostname: prova

但是当我尝试浏览我的网络应用程序时,它不起作用。 我试过http://prova.app, 192.168.10.10:8000, 127.0.0.1:8000, http://localhost:8000 但还是不行。

我的主机文件:

# 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 prova.app

更新: 我重新安装了 VirtualBox(最新版本),使用 PuTTygen 生成一个 ssh 密钥,将公共保存为 id_rsa.pub,将私有保存为 id_rsa(无扩展名)并放入 .ssh 文件夹。 克隆 Homestead 存储库并添加 homestead 盒子。 配置 Homestad.yaml 并在添加项目后开始“vagrant up”,现在一切正常。

【问题讨论】:

  • 什么不完全有效?
  • 添加到主机文件也许?!我也加了...
  • 如果您不将其添加到您的主机文件中,您的计算机将向 DNS 请求 prova.app,这将失败,因为该域在“全球”互联网上不存在。
  • 我已经将它添加到我的主机文件中 C:/windows/system32/drivers/etc/。
  • 不起作用的是,如果我设置“prova.app”或任何关于宅基地 ecc 的地址。在我的浏览器网址栏中,它给了我一条消息错误“无法访问该站点”。

标签: php laravel vagrant ip homestead


【解决方案1】:

你能 Ping 你的 vagrant box IP 还是失败并收到 0 个数据包?

这听起来很像bug in VirtualBox 5.1.24。该票被标记为 Linux 主机,但它也可能影响 Windows。

这个问题似乎是由 VirtualBox 未能为仅主机网络创建路由引起的。将 VirtualBox 回滚到 5.1.22 为我解决了这个问题(在 Linux 上)。如果您也回滚并且它解决了问题,我建议您在错误跟踪器上加入让他们知道。祝你好运!

【讨论】:

  • 我失去了希望,我尝试了一切。我尝试 ping 192.168.10.10 但我收到 4 包未到。我想我会尝试使用 vmware 重新安装所有内容。 @DaveLak
  • 不,我以前从未安装过宅基地
  • 我正在关注 Laravel.com 的指令。我做了文档中写的所有事情,但是我对 ssh 有问题我使用了不同的命令“vagrant init HashiCorp/precise32”,我认为它会自动生成一个 ssh 密钥。会不会错?对不起我的英语@DaveLak
  • 您不需要运行vagrant init HashiCorp/precise32。这会初始化一个 32 位 Ubuntu 12.04 机器,而不是 Homestead。您应该只运行vagrant box add laravel/homestead 来启动,然后克隆 Homestead git repo,转到该目录和git checkout 最新版本,然后运行init.bat for windows。完成运行后,您应该能够在该目录中运行vagrant up 并开始运行。不过,我并不是真正的 Windows 人,所以恐怕我无法提供更多帮助
  • 是的,我终于成功了!谢谢你。我在生成 ssh 代码时遇到了问题。
猜你喜欢
  • 2016-03-30
  • 1970-01-01
  • 2015-10-08
  • 2015-08-25
  • 2016-08-12
  • 1970-01-01
  • 2019-04-22
  • 1970-01-01
  • 2017-04-24
相关资源
最近更新 更多