Book Image

Vagrant Virtual Development Environment Cookbook

Book Image

Vagrant Virtual Development Environment Cookbook

Overview of this book

Table of Contents (17 chapters)
Vagrant Virtual Development Environment Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Forwarding ports from a Vagrant machine


Although running a virtual machine in a completely standalone mode can be useful, we can also use Vagrant to extend the utility of local computing environments. For example, when developing web applications, Vagrant can be used to create a virtual machine for the runtime environment of the application. When testing the application, however, it might be simpler to refer to the application as running on the host machine: a localhost URL. Using localhost URLs allows for simpler configuration: a localhost configuration avoids the need to maintain configuration settings to use the application in the virtual machine. We can enable a Vagrant virtual machine to listen on localhost ports through a technique known as port forwarding. Port forwarding allows us to forward a port on the Vagrant machine to a port on the host machine. For example, forwarding port 80 (the standard HTTP port) on the Vagrant machine to port 8080 on the host machine allows us to access...