Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Setting up Port Forwarding with Vagrant

Linda Nichols edited this page Feb 5, 2014 · 1 revision

In some cases, you may want to access a port on your host computer and have your request forwarded to a port on the guest virtual machine. Port-forwarding can be set in Vagrant by adding one line to the Vagrantfile.

In this example, accessing "localhost:8080" will access port 80 on the guest machine, and "localhost:8443" will access port 443 on the guest machine:

 config.vm.network :forwarded_port, guest: 80, host: 8080  
 config.vm.network :forwarded_port, guest: 443, host: 8443

The problem with 80 and 443

This post explains problems that can be encountered by forwarding to ports that are under 1024. You will notice that in the default xtuple-vagrant Vagrantfile, we forward to ports 8888 and 8443 so that the application does not require admin access.