Laravel 连接到 Homestead.test 的宅基地问题

Laravel Homestead problem connecting to Homestead.test

我遵循了 Laravel 指南,我已经启动并 运行ning 了 Vagrant,但是当我访问“http://homestead.test/”时,没有加载任何内容。

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: homestead.test
      to: /home/vagrant/code/Laravel/public

databases:
    - homestead

主机

#   127.0.0.1       localhost
#   ::1             localhost
#   192.168.10.10   homestead.test

任何人都可以阐明我错过了什么吗?谢谢。

更新: 我现在在尝试通过 GitBash 运行 Homestead 时遇到以下错误:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "29535830-0e33-4f82-a359-6973606f6529", "--natpf1", "delete", "ssh"]

Stderr: VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "LockMachine(a->session, LockType_Write)" at line 529 of file VBoxManageModifyVM.cpp

你应该有这样的东西:

---ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: c:/Users/UserName/.ssh/id_rsa.pub
keys:
    - c:/Users/UserName/.ssh/id_rsa
folders:
    - map: e:/MyFolder/Homestead
      to: /home/vagrant/code
sites:
    - map: homestead.test
      to: /home/vagrant/code/public
databases:
    - homestead

我在这里学会了如何做: https://medium.com/@eaimanshoshi/i-am-going-to-write-down-step-by-step-procedure-to-setup-homestead-for-laravel-5-2-17491a423aa

您似乎不小心注释掉了 hosts 条目。

改变

#   127.0.0.1       localhost
#   ::1             localhost
#   192.168.10.10   homestead.test

#   127.0.0.1       localhost
#   ::1             localhost

192.168.10.10   homestead.test