没有输入文件指定Laravel Homestead

时间:2015-06-01 15:32:23

标签: laravel-5 homestead

我是laravel的新手我仍然对Homestead.yaml

的配置感到困惑

我的laravel项目所在地 C:/ wamp / www / laravel和Homestead.yaml我配置如下

folders:
- map: /wamp/www/laravel
  to: /home/Vagrant/Code

sites:
- map: homestead.app
  to: /home/Vagrant/Code/Laravel/public

databases:
- homestead

variables:
- key: APP_ENV
  value: local

此配置有什么问题?我还必须手动创建

/home/Vagrant/Code 

/home/Vagrant/Code/Laravel/public?

如果是,在哪个windows目录?我对/ home目录感到困惑,因为我使用的是Windows 8机器。

1 个答案:

答案 0 :(得分:10)

啊,是的,宅基地配置也让我困惑不已。我建议您购买电子书Easy Laravel 5 by Jason Gilmoreread the homestead chapter for free online right here。这是他关于家园配置的章节,帮助我理解了如何做到这一点。电子书还包含很多关于Laravel 5开发的其他好东西,并且经常更新。

更新:The Laravel 5 Beauty blog还有一个非常容易理解的指南,介绍如何为Laravel 5.1设置家园。在Windows,Linux和Mac上都有。

那就是说,我会在这里试着回答你的问题。第5步是如何设置宅基地配置。不,你不必自己创建vagrant / Code文件夹。它是您提供的路径的别名。

0。 Install Composer如果您还没有。

还要将作曲家bin添加到您的路径中:

enter image description here

LINK TO BIGGER VERSION OF PICTURE BELOW

enter image description here

1。确保您已下载最新版本的VagrantOracle VirtualBox

2。添加laravel框:$ vagrant box add laravel/homestead

3. 安装Homestead CLI工具:$ composer global require "laravel/homestead=~2.0"

4. :创建.homestead文件夹:

$ cd - >转到您的用户文件夹

$ homestead init - >创建.homestead文件夹

此处还需要注意您需要包含id_rsa和id_rsa.pub文件的.ssh文件夹。如果您的用户文件夹中没有follow this guide to get it.

5. 编辑您的Homestead.yaml文件。我将在此处使用我的设置作为示例:

LINK TO BIGGER VERSION OF PICTURE BELOW

enter image description here

6。转到C:\Windows\System32\drivers\etc\并编辑主机文件。它会警告您并要求管理员权限。只需用admin控件打开它。

使用您在homestead.yaml文件中设置的网址编辑您的主机文件:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

192.168.10.10   phpmyadmin.local
192.168.10.10   lara.local
192.168.10.10   todoparrot.local

7. 运行以下CLI命令以配置vagrant。说实话,我不太确定这是做什么的,但它有点重启流浪者,所以它与你的homestead.yaml和主机配置保持同步。

$ vagrant global-status - >注意一开始就出现的小数字。我的是2a6e97d

$ vagrant provision 2a6e97d

8。运行$ homestead up,让它完成运行并转到您的网址,在我的案例中为lara.local。这是我的屏幕:

enter image description here

我希望这不会让人感到困惑。建立宅基地是第一次真正的痛苦,但当你"得到"如何运作,与它一起发展成为纯粹的幸福。

如果有任何不清楚的地方,请写一条评论,我会尽力帮助:)

相关问题