访问页面显示 No input file specified.

我按照教程一步步做下来发现访问页面 homestead.test/ 的时候页面内只显示

No input file specified.

看了一下 nginx 错误日志

2020/04/30 11:13:23 [error] 3141#3141: *1 FastCGI sent in stderr: “Unable to open primary script: /home/vagrant/Code/public/index.php (No such file or directory)” while reading response header from upstream, client: 192.168.10.1, server: homestead.test, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.2-fpm.sock:”, host: “homestead.test”

的确是没有这个文件

/home/vagrant/Code/public/index.php

接着又去 ~/Code 目录下看发现我这边目录多了一个层及

/home/vagrant/Code/Laravel

ls /home/vagrant/Code/Laravel
app artisan bootstrap composer.json composer.lock config database package.json phpunit.xml public README.md resources routes server.php storage tests vendor webpack.mix.js

我这里多了一个Laravel目录 ,而nginx里面的 root目录是

root “/home/vagrant/Code/public”

我是按照教程 生成的项目

$ cd ~/Code
$ composer create-project laravel/laravel Laravel --prefer-dist "6.*"

这里需要改nginx配置,或者改一下Code的目录结构吗?

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 3

自己搞错了,Homestead.yaml 配置弄那个错了 site部分应该改为

sites:
    - map: homestead.test
      to: /home/vagrant/Code/Laravel/public
3年前 评论

同样的错误,折腾了几次才发现。教程应该在创建好Laravel目录后再提醒对Homestead.yaml中的sites配置进行修订。

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!