vagrant share with laravel homestead

前端 未结 4 1334
一个人的身影
一个人的身影 2021-02-08 18:29

I\'m running into an issue getting vagrant share to work in conjunction with the laravel homestead vagrant box. My homestead.yaml file looks like:

---
ip: \"192.         


        
相关标签:
4条回答
  • 2021-02-08 19:10

    The first step is to create an account for Vagrant Cloud, if you haven't already.

    Once you've done that, in your terminal (not logged into the Homestead machine) run vagrant login and login with your details.

    Then run vagrant global-status to find the ID of the vagrant machine Homestead is running on.

    Run vagrant share 123a4 (where 123a4 is the machine ID) and your machine will be shared!

    Note that you might have to set up your Nginx configuration to listen for the URL that has been generated for you so it points to the correct site on the machine.

    0 讨论(0)
  • 2021-02-08 19:12

    There's a solution without having to do anything on your homestead VM.

    You can install a program called ngrok which does a similar thing to vagrant share but works better with the multiple sites that Homestead uses. You will need to sign up for an account but basic usage is free.

    Run: ngrok http -host-header=rewrite your-local-site.app:80

    (Where your-local-site.app is what's used for the map directive in your Homestead.yaml file)

    Then your site will be available globally on the url that ngrok gives you.

    0 讨论(0)
  • 2021-02-08 19:18

    @sanaco's answer missed some steps for me. This is full command to create the share (after logging in)

    vagrant share --http 80 --name silly-sausage
    

    On completion the command will out put the share URL which should look like this

    http://silly-sausage.vagrantshare.com
    

    Once the share is up you need to ssh into the vagrant box with

     vagrant ssh
    

    And run

    serve silly-sausage.vagrantshare.com ~/Code/project/path/public 
    

    Without the http flag vagrant assigns 443 to http which makes nginx complain about HTTPS port being used for HTTP connection.

    By specifying the name you only need to do the serve command first time.

    0 讨论(0)
  • 2021-02-08 19:27

    Try this command in your homestead directory: vagrant provision

    To get share URL use this command: vagrant share

    Sometimes it doesn't worke on windows. Use vagrant share --http 8000

    8000 is port as homestead uses port forwarding 8000 -> 80

    Note: To use vagrant share you must have ngrok installed.

    0 讨论(0)
提交回复
热议问题