![没有指定输入文件 - Homestead,vagrant](https://linux22.com/image/702499/%E6%B2%A1%E6%9C%89%E6%8C%87%E5%AE%9A%E8%BE%93%E5%85%A5%E6%96%87%E4%BB%B6%20-%20Homestead%EF%BC%8Cvagrant.png)
未指定输入文件。
是浏览器中显示的错误信息。
我听到你说:“没有指定输入文件”意味着你需要检查Homestead.yaml
文件中的文件夹映射,嗯
C:\Users\Andy\Homestead\Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/Homestead/.ssh/id_rsa.pub
keys:
- ~/Homestead/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: test.local
to: ~/Code/test.local
databases:
- homestead
我的Homestead.yaml
文件格式正确,即没有制表符,只有空格和目录被正确映射。
我的项目一开始很简单:
C:\Users\Andy\Code\test.local\index.php
<?php phpinfo(); ?>
在虚拟机上:
vagrant@homestead:~$ ls -l /home/vagrant/Code/
drwxrwxrwx 1 vagrant vagrant 0 Apr 14 09:37 test.local
显然,它存在
我的主机文件已到位并映射到正确的 IP
192.168.10.10 test.local
VM 启动成功:
$ vagrant reload --provision
...
homestead-7: SSH username: vagrant
homestead-7: SSH auth method: private key
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
==> homestead-7: Setting hostname...
...
homestead-7: Running: script: Creating Certificate: test.local
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Creating Site: test.local
==> homestead-7: Running provisioner: shell...
homestead-7: Running: script: Restarting Nginx
...
我试过了
$ vagrant reload --provision
那会是什么呢?无论如何,我都会得到
未指定输入文件。
编辑:添加
rewrite ^/index\.php/(.*)$ /$1 permanent;
location / {
index index.php;
并/etc/nginx/sites-enabled/test.local
重新启动 nginx 服务器我现在在浏览器中收到 404 Not Found,我猜这是进展?
查看错误日志:
2017/04/17 12:15:00 [error] 3538#3538: *1 "/usr/share/nginx/~/Code/test.local/index.php" is not found (2: No such file or directory), client: 192.168.10.1, server: test.local, request: "GET / HTTP/1.1", host: "test.local"
显然上面的路径看起来有问题。我的文件如何连接到那个,我如何定义正确的路径?Homestead.yaml
/usr/share/nginx/...
我们最终到达了那里。有:
sites:
- map: test.local
to: /home/vagrant/Code/test.local
并且vagrant reload --provision
我们index.php
成功访问了文件。
谢谢
答案1
应该检查 Nginx 的 access.log,它C:\Users\Andy\Code\test.local\index.php
不包含对 homestead.yaml 的引用。
本问答解释了如何解决这个问题。确保 Nginx 配置包含对 php 文件的引用:
rewrite ^/index\.php/(.*)$ /$1 permanent; location / { index index.php; try_files $uri $uri/ /index.php$args; }