安装 Homestead 后,我在浏览器中看到“未指定输入文件”。如何访问我的 Laravel 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31642890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 12:03:00  来源:igfitidea点击:

After installing Homestead I get "No input file specified" in the browser. How can I access my laravel project

laravellaravel-5virtual-machinevirtualboxhomestead

提问by Junior

I think I finally got homestead installed on my laptop! Now, I am trying to view my laravel project in the browser.

我想我终于在我的笔记本电脑上安装了宅基地!现在,我正在尝试在浏览器中查看我的 Laravel 项目。

When I open "dev.app" in the browser I get a message that say "No input file specified." which I think means that my homestead is working but the laravel project is not there/setup.

当我在浏览器中打开“dev.app”时,我收到一条消息“未指定输入文件”。我认为这意味着我的宅基地正在工作,但 laravel 项目不在那里/设置。

I have created a folder called Projects on my local laptop (i.e. ~/Projects). Then from inside of it i executed this command

我在本地笔记本电脑上创建了一个名为 Projects 的文件夹(即 ~/Projects)。然后从里面我执行了这个命令

laravel new dev

Laravel 新开发

But I still get the same error message in the browser i.e. "No input file specified." I have also tried to open this link "dev.app"/dev" but I still get the same message.

但我仍然在浏览器中收到相同的错误消息,即“未指定输入文件”。我也尝试打开此链接“dev.app”/dev”,但我仍然收到相同的消息。

What I am doing wrong?

我做错了什么?

Here is the content of my Homestead.yaml file

这是我的 Homestead.yaml 文件的内容

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Projects
      to: /home/vagrant/Code

sites:
    - map: dev.app
      to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

variables:
    - key: APP_ENV
      value: local

Additional, when I execute the following 2 commands in order

另外,当我按顺序执行以下2个命令时

cd ~/Projects
ls

I see the following directories dev homestead

我看到以下目录 dev homestead

What should I do to see my project when I go to dev.app ? Do I need to do anything from my Ubuntu VM or I should be able to edit the files directly in located on ~\Projects\dev" from my laptop?

当我去 dev.app 时,我应该怎么做才能看到我的项目?我是否需要从我的 Ubuntu VM 中执行任何操作,或者我应该能够直接在我的笔记本电脑上编辑位于 ~\Projects\dev" 中的文件?

采纳答案by peterm

  1. Add an entry in /etc/hostson your local machine

    192.168.10.10 dev.app
    
  2. Correct the path to the public folder in the sites section of your Homestead.yaml

    sites:
        - map: dev.app
           to: /home/vagrant/Code/dev/public
    
  1. /etc/hosts本地机器上添加一个条目

    192.168.10.10 dev.app
    
  2. 更正您的站点部分中公用文件夹的路径 Homestead.yaml

    sites:
        - map: dev.app
           to: /home/vagrant/Code/dev/public