legend3---用Homestead配置后报错“No input file specified.”

legend3---用Homestead配置后报错“No input file specified.”

一、总结

一句话总结:

自己项目上传到github的时候多增加了一层legend3的github目录,然后没有去修改Homestead.yaml,所以nginx找不到文件了
用 查看错误日志 的方法可以比较快的排查错误

1、No input file specified错误 出现的最可能的原因是什么?

No input file specified表示apache或者nginx没有找到文件,那么最有可能的原因就是配置的路径出错

2、用Homestead配置后报错“No input file specified.”的排错方向是什么?

肯定是apache服务器或者nginx服务器没找到文件,去看看apache或者 nginx的配置

3、排查错误比较好的方法是什么?

查看错误日志:nginx错误日志的位置 为:/var/log/nginx/
2019/09/10 18:42:03 [error] 1267#1267: *12 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/legend3/public/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.10.1, server: legend3.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "legend3.com"
2019/09/10 18:42:05 [error] 1267#1267: *12 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/legend3/public/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.10.1, server: legend3.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "legend3.com"

4、Homestead重启虚拟机指令?

vagrant reload

二、用Homestead配置laravel开发环境后网页报错“No input file specified.”

转自或参考:用Homestead配置laravel开发环境后网页报错“No input file specified.”
https://blog.csdn.net/haisley/article/details/82083203

 

用Homestead配置laravel开发环境后,打开项目网页报错“No input file specified”,没有指定输入文件

查找原因,发现虚拟机nginx站点指定的文件夹是/home/vagrant/code/public,而我在Homestead目录下的Homestead.yaml文件里,sites指定的目录是/home/vagrant/Code/public,大小写不同导致路径不同了,所以站点指定目录code下其实是没有代码的,会报错。

所以我把Homestead.yaml文件里的站点修改成指定小写code目录就解决了这个报错。

下面是无意中发现这个细节错误的过程。

1、你安装的Homestead目录下,输入以下命令进入虚拟机(已经启动vagrant up):

vagrant ssh

2、查看nginx配置文件(/etc/nginx/sites-available/)

cd /etc/nginx/sites-available

用vim命令查看当前目录下的网站域名文件:

3、发现站点指定的路径是/home/vagrant/code/public,和我在Homestead.yaml配置的路径Code大写不同。

输入 :q!退出编辑。

输入exit退出虚拟机。

4、改正Homestead.yaml文件路径。

5、重启虚拟机

vagrant reload

6、再次打开项目网页就不报“No input file specified”这个错了。

可能有人需要这个教程《Homestead中第一个Laravel项目502 Bad Gateway》。

三、出错原因

自己项目上传到github的时候多增加了一层legend3的github目录,然后没有去修改Homestead.yaml,所以nginx找不到文件了

 

nginx错误日志内容:

2019/09/10 18:42:03 [error] 1267#1267: *12 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/legend3/public/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.10.1, server: legend3.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "legend3.com"
2019/09/10 18:42:05 [error] 1267#1267: *12 FastCGI sent in stderr: "Unable to open primary script: /home/vagrant/legend3/public/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.10.1, server: legend3.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "legend3.com"

 
原文地址:https://www.cnblogs.com/Renyi-Fan/p/11502962.html