duanqu9292 2016-10-29 17:51
浏览 83
已采纳

Homestead没有为自定义PHP项目指定的输入文件

I'm working with Homestead. Laravel apps are just serving fine, but when I try to setup some custom script, it shows me that No input file specified.

Here is my yaml file.

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: /Users/Mubin/Sites
      to: /home/vagrant/Code

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

    - map: dev.app
      to: /home/vagrant/Code/dev/index.php
databases:
    - homestead

I just want to put all my code under dev folder and want to access it from vagrant homestead box

Guide where am I doing wrong?

PS.

I tried to remove index.php from the end, and then nginx throws 403 Forbidden

  • 写回答

1条回答 默认 最新

  • douhao7677 2016-11-04 21:43
    关注

    anyone having the same issue, I found a solution, mocked one may be; but it did work for me.

    I added new public folder in my dev folder and place all my other custom PHP scripts put in that.

    Directory structure was something like this for me

    dev
        public
            folder1
                index.php
            folder2
                index.php
            folder3
                index.php
            ...
    

    and I was able to access it like this

    dev.local/folder1/index.php
    dev.local/folder2/index.php
    dev.local/folder3/index.php
    

    and here is my Homestead.yaml file

    ---
    ip: "192.168.30.30"
    memory: 2048
    cpus: 1
    provider: virtualbox
    
    authorize: ~/.ssh/id_rsa.pub
    
    keys:
        - ~/.ssh/id_rsa
    
    folders:
        - map: /Users/Mubin/Sites
          to: /home/vagrant/Code
    
    sites:
        - map: test.app
          to: /home/vagrant/Code/test/public
    
        - map: dev.local
          to: /home/vagrant/Code/dev/public
    databases:
        - homestead
    

    and in my /etc/hosts file

    127.0.0.1    dev.local test.app
    

    Hope this will help someone, someday. :)

    I'd set up vagrant for laravel and custom PHP projects. Also, integrated with PHP Storm to work with x-debug. Leave a message if you've any issue.

    Happy coding, x-debugging.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?