Laravel homestead 和 vagrant 设置不工作

Laravel homestead and vagrant setup not working

我遵循了 vagrant 和 homestead 的原始文档,但是每次 site.app:8000 您访问它时,它都会一直加载,没有任何反应。这个配置文件有错误吗?

Homestead.yaml

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Developer/laravel
      to: /home/vagrant/laravel

sites:
    - map: hello-world.local
      to: /home/vagrant/laravel/hello-world/public

databases:
    - homestead

主机

192.168.10.10    hello-world.local

vagrant up log

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 (guest) => 8000 (host) (adapter 1)
    default: 443 (guest) => 44300 (host) (adapter 1)
    default: 3306 (guest) => 33060 (host) (adapter 1)
    default: 5432 (guest) => 54320 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 5.0.20
    default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/nikla/Developer/homestead
    default: /home/vagrant/laravel => /Users/nikla/Developer/laravel
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

nmap日志

Starting Nmap 7.12 ( https://nmap.org ) at 2016-07-29 22:55 ART
Nmap scan report for 192.168.10.10
Host is up (0.00063s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
3306/tcp open  mysql
5432/tcp open  postgresql
9000/tcp open  cslistener

Nmap done: 1 IP address (1 host up) scanned in 13.19 seconds

检查:

  • id_rsa.pub 和 id_rsa 在此文件夹中。
  • 您的主机中存在 /Users/nikla/Developer/laravel 文件夹。
  • /home/vagrant/laravel 存在于您的 Vagrant VM 机器中。您可以使用命令 "vagrant ssh".
  • 登录机器查看它
  • 尝试在没有 8000 端口的情况下访问 http://test.app

我在您的 Homestead.yaml 文件中没有看到数据库。你应该在这个文件中有下一个文本

databases:
    - homestead

我查看了您的 "vagrant up" 日志,我发现一切正常。我已经将你的日志与我机器的日志进行了比较,并且相似。

尝试在网络浏览器中打开 IP(将 IP 更改为您的 Vagrant VM IP):

http://192.168.10.10/

您是否有一些防火墙、防病毒软件或其他可以禁用通信的软件?

尝试执行 nmap 以查看打开的端口。我将我的 nmap 从我的主机粘贴到我的虚拟机,所以你可以看到哪些端口是打开的。

$ nmap 192.168.10.10

Starting Nmap 6.47 ( http://nmap.org ) at 2016-07-30 01:48 Hora de verano romance
Nmap scan report for homestead.app (192.168.10.10)
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Host is up (0.0019s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
111/tcp  open  rpcbind
443/tcp  open  https
3306/tcp open  mysql
5432/tcp open  postgresql
9000/tcp open  cslistener
MAC Address: 08:00:27:CD:99:8C (Cadmus Computer Systems)

Nmap done: 1 IP address (1 host up) scanned in 21.83 seconds