未指定输入文件 Laravel Homestead

No Input File Specified Laravel 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 机器。

是啊,homestead配置也让我很困惑。我可以推荐您购买电子书 Easy Laravel 5 by Jason Gilmore, or read the homestead chapter for free online right here。正是他关于 homestead 配置的章节帮助我理解了如何去做。该电子书还包含许多其他关于 Laravel 5 开发的好东西,并且经常更新。

更新:The Laravel 5 Beauty blog 也有一个非常容易理解的指南,介绍如何为 Laravel 5.1 设置 homestead。 Windows、Linux 和 Mac.

话虽如此,我会尽量在这里回答您的问题。第 5 步是如何设置 homestead 配置。不,您不必自己创建 vagrant/Code 文件夹。这是您提供的路径的别名。

0. Install Composer 如果你还没有。

同时将 composer bin 添加到您的路径中:

LINK TO BIGGER VERSION OF PICTURE BELOW


1.确保你已经下载了最新版本Vagrant and Oracle 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


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

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

# 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。老实说,我不太确定这是做什么的,但它有点像重新启动 vagrant,所以它与你的 homestead.yaml 和主机配置保持同步。

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

$ vagrant provision 2a6e97d


8.运行$ homestead up,让它完成运行然后去你的url,在我的例子中lara.local。这是我的屏幕:


我希望这不会太混乱。第一次设置 homestead 真的很痛苦,但是当你 "get" 它是如何工作的时候,开发它就变成了纯粹的幸福。

如果有任何不清楚的地方,请发表评论,我会尽力提供帮助:)