【问题标题】:Laravel homestead not workingLaravel宅基地不工作
【发布时间】:2016-03-30 03:32:14
【问题描述】:

我正在尝试设置 Homestead,但它不起作用。我已经关注https://laravel.com/docs/5.2/homestead 上的文档并观看 laracast 上的视频。但仍然无法弄清楚为什么它不起作用。当我转到 test.app:8000 时,会显示以下消息:

没有指定输入文件。

另外,当我更改 homestead.yaml 文件中的路径时,我会执行“vagrant provision”。

这就是我的 homestead.yaml 文件的样子(在 Homestead/Homestead.yaml 中):

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/documents/vagrant/sites
      to: /home/vagrant/Code

sites:
    - map: test.app
      to: /home/vagrant/Code/test

databases:
    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

我的文件夹路径:“~/documents/vagrant/sites”确实存在,因为我可以 cd 进入它。我还将 test.app 添加到我的 etc/hosts 文件中(参见屏幕截图)。

我做错了什么...尝试设置宅基地好几个小时!

【问题讨论】:

    标签: php laravel vagrant virtualbox homestead


    【解决方案1】:

    在您的 /etc/hosts 中,将 127.0.0.1 test.app 替换为 192.168.10.10 test.app

    替换

    sites:
    - map: test.app
      to: /home/vagrant/Code/test
    

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

    然后运行vagrant provision

    【讨论】:

    • 在你的浏览器中你试过test.app吗?没有 test.app:8000
    • 是的,但仍然告诉我:“没有指定输入文件。”
    • @jamie 尝试 ssh 到 Vagrant 机器,登录后运行 cd Code/test/public。是正确的路径吗?当您运行ls 时,您是否在此目录中看到index.php
    • 它说没有这样的文件或目录。当我使用 cd 进入路径时。现在应该怎么办?? @MarcinNabiałek
    【解决方案2】:

    在您的测试目录中创建index.php,或者如果您正在使用 laravel,请将您的代码更改为此

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

    也许这个话题能帮助你理解问题http://laravel.io/forum/06-04-2014-no-input-file-specified-using-homestead

    【讨论】:

    • 感谢现在的工作。有没有办法我可以在最后删除 :8000 ?所以我可以输入 test.app?
    猜你喜欢
    • 2015-10-08
    • 2016-08-12
    • 2017-12-31
    • 1970-01-01
    • 1970-01-01
    • 2019-04-22
    • 2017-04-24
    • 2015-03-18
    • 2016-04-17
    相关资源
    最近更新 更多