Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant share with laravel homestead

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.168.10.10"
memory: 2048
cpus: 1

authorize: /Users/me/.ssh/id_rsa.pub

keys:
    - /Users/me/.ssh/id_rsa

folders:
    - map: /Users/me/Projects/laravel
      to: /home/vagrant/laravel

sites:
    - map: laravel.app
      to: /home/vagrant/laravel/public

variables:
    - key: APP_ENV
      value: local

When I hit http://laravel.app:8000 - everything works fine. When I start up vagrant share the URL that's generated returns the error No input file specified.

I'm stumped. Searching Google for hours hasn't resulted in a solution. I'm sure it's just some basic configuration thing and I'm not connecting the dots. Any pointers would be appreciated. Thanks!

like image 300
rfoote Avatar asked Nov 05 '14 17:11

rfoote


2 Answers

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.

like image 83
Richard Avatar answered Oct 15 '22 09:10

Richard


@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.

like image 25
Mike Miller Avatar answered Oct 15 '22 08:10

Mike Miller