laravel - Laravel Homestead:无法从 VM 内部 ping 任何 .local 站点
问题描述
不知道问题出在哪里。我的另一个同事从主机 Mac 以及从 VM 内部 ping foo.local 没有问题。
我Homestead.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: vppaportal.local
to: /home/vagrant/code/vppa-portal/public
- map: iosportal.local
to: /home/vagrant/code/ios-portal/public
- map: ascent.local
to: /home/vagrant/code/ascent/public
- map: peem.local
to: /home/vagrant/code/peem-v2/public
databases:
- homestead
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# zray:
# If you've already freely registered Z-Ray, you can place the token here.
# - email: foo@bar.com
# token: foo
# Don't forget to ensure that you have 'zray: "true"' for your site.
因此,当我的 Homestead 在我的 Mac 上运行时,我可以ping iosportal.local
并且它可以工作,但是当我ssh
进入机器时,ping iosportal.local
我会得到:
vagrant@homestead:~/code$ ping iosportal.local
ping: iosportal.local: Temporary failure in name resolution
解决方案
我通过/etc/hosts
在 Homestead 内部打开并添加:
127.0.1.1 iosportal.local
关键是我的同事都不必这样做,因此我认为这是一种临时解决方法。如果有人会提出更好的解决方案,我很乐意投票并更改已接受的答案。
推荐阅读
- php - 如何使用 ajax、jquery 和 php 从表中更新数据?
- azure-web-app-service - Azure Web 应用程序 - 从外部进程同步文件
- java - 单击 RecyclerView 时将数据写入 firebase
- c - 有没有一种简单的方法可以在 code::blocks 中显示变量的地址?
- angular - Importing components in Nativescript Angular
- javascript - 如何将以下一系列 for 循环缩小为不太紧凑的代码?
- java - 相对于中心旋转图像
- c++ - 由于未分配指针,初始化对象向量失败
- python - 居中数据框的值
- c++ - const std::shared_ptr<> 的初始化没有匹配的构造函数