Homestead ERR_SOCKET_NOT_CONNECTED After Mac OS Update



我最近在我的Mac上更新了Big Sur,从那以后我就不能以网页的形式访问我的任何虚拟机了。我已经使用Homestead预期的安装过程销毁并重建了这个VM。

  • VirtualBox 6.1.28
  • 来自发布分支的最新Homestead版本
  • 的流浪汉2.2.18

这是我看到的错误

在花了很长时间研究这个问题之后,许多人似乎通过将网站添加到他们的hosts文件中来解决这个问题。为了确认我已将此添加到hosts:

在hosts

中查看没有站点的URL时出错:登录http://localhost:8000/,可以查看到虚拟机。去http://192.168.10.10行不通。使用curl 192.168.10.10从流浪汉框生成该页的预期HTML输出。我的机器上的curl localhost:8000也是如此。如果我在我的机器上尝试curl 192.168.10.10,我得到curl: (55) getpeername() failed with errno 22: Invalid argument

我已经尝试了Virtualbox中的所有其他网络配置,使用NAT是唯一允许SSH连接的网络配置。似乎请求没有到达VirtualBox..可能是因为套接字未连接的错误。

Socket统计似乎显示它正在监听端口80

到目前为止,我已经销毁并重新构建了这个盒子,所以它接近于任何人都应该拥有的预期安装。

注。"site.test"是实际名称的占位符。

这是我的宅基地。yaml: https://pastebin.com/qhPdWCNv

---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Sites
to: /home/vagrant/code/
sites:
- map: site.test
to: /home/vagrant/code/site/public
php: "7.4"
databases:
- homestead
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: false
services:
- enabled:
- "mysql"
#    - disabled:
#        - "postgresql@11-main"
#ports:
#    - send: 33060 # MySQL/MariaDB
#      to: 3306
#    - send: 4040
#      to: 4040
#    - send: 54320 # PostgreSQL
#      to: 5432
#    - send: 8025 # Mailhog
#      to: 8025
#    - send: 9600
#      to: 9600
#    - send: 27017
#      to: 27017

这是我的hosts文件:https://pastebin.com/Y6Re15iy

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
192.168.10.10   site.test
::1             localhost

Vagrant 6.1.28似乎限制了来宾的有效IP地址。我花了好几个小时才弄明白,然后看了说明书。换了我的宅地就解决了。在/etc/hosts

中修改了Yaml IP到192.168.56.0来自手册:在Linux, Mac OS X和Solaris Oracle VM VirtualBox将只允许将192.68.56.0/21范围内的IP地址分配给仅主机适配器。

对于遇到此问题的任何人,我通过更新虚拟机到新IP,更改域和清除dns缓存(dscacheutil -flushcache)来修复此问题。

最新更新