Laravel Homestead问题连接到Homestead.test

时间:2018-11-06 02:27:42

标签: laravel laravel-5 localhost virtualhost homestead

我遵循Laravel准则,并且已经启动并运行了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

2 个答案:

答案 0 :(得分:1)

您似乎不小心将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

答案 1 :(得分:0)

您应该具有以下内容:

---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