Now that you have a web server running and accessible from your machine, you have a fairly functional development environment. But in addition to providing a development environment, Vagrant also makes it easy to share and collaborate on these environments. The primary feature to do this in Vagrant is called Vagrant Share.
Vagrant Share is a plugin that lets you share your Vagrant environment to anyone around the world with an Internet connection. It will give you a URL that will route directly to your Vagrant environment from any device in the world that is connected to the Internet.
Warning: The Vagrant Share service is not designed to serve production-level traffic. Only share development or Q/A environments, not production content.
Vagrant share requires ngrok. If you don't have ngrok, follow their install documentation to install it.
»Install the plugin
Install vagrant share.
$ vagrant plugin install vagrant-shareInstalling the 'vagrant-share' plugin. This can take a few minutes...Fetching vagrant-share-1.1.10.gemInstalled the plugin 'vagrant-share (1.1.10)'!
For more information or installation alternatives visit the installation docs.
»Share the environment
$ vagrant share##... output truncated ...==> default: Creating Vagrant Share session...==> default: HTTP URL: http://b1fb1f3f.ngrok.io##... output truncated ...
Open a web browser and visit the URL from your output. It should load the Apache page we setup earlier.
If you modify the files in your shared folder and refresh the URL, you will see your update. The URL is routing directly into your Vagrant environment, and works from any device in the world that is connected to the internet.
End the sharing session.
$ ^C==> default: Halting Vagrant share!
Refresh the URL again to verify that your environment is no longer being shared.
To learn more about Vagrant Share, see the complete Vagrant Share documentation.
You have successfully shared your environment with the world. Congratulations! Read on to learn about the teardown process.