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

Get Vagrant Virtual Development Environment Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.