Skip to content

Instantly share code, notes, and snippets.

@resourcemode
Last active October 4, 2016 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resourcemode/7c7a9de1bb2eda6d9fbcc2343a8725a3 to your computer and use it in GitHub Desktop.
Save resourcemode/7c7a9de1bb2eda6d9fbcc2343a8725a3 to your computer and use it in GitHub Desktop.
http port forwarding to access VM vagrant hosted applications
Access your local vagrantbox from your remote or other machine within the network.
Get the host machine IP and add it in the /etc/hosts of your server/computer that will access the vagrantbox.
E.g 10.9.6.91 yourdomain.dev
First step is to create this file 'http' in /etc/pf.anchors and add the data below:
rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/http"
Next step is to create this file 'pf-http.conf' in /etc and add the data below:
rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/http"
Next step is to execute this on your terminal sudo pfctl -ef /etc/pf-http.conf
Edit your Port Forwarding in vagrantbox VM
Add the info below:
Name: tcp5901
Protocol: TCP
Host Port: 5901
Guest Port: 5901
Name: tcp8080
Protocol: TCP
Host Port: 8080
Guest Port: 80
Name:5672
Protocol: TCP
Host Port: 5672
Guest Port: 5672
Done...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment