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!
@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.
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.
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.