Customfile for VVV to run on host machine IP address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you can put this file in place by | |
# navigating to your VVV directory (e.g. `cd ~/vagrant-local`) | |
# and running | |
# curl -O https://gist.githubusercontent.com/salcode/da45f09ca0c319a108db/raw/Customfile | |
# set port forwarding from host 8080 to guest 80 | |
# set port forwarding from host 8443 to guest 443 | |
config.vm.network "forwarded_port", guest: 80, host: 8080 | |
config.vm.network "forwarded_port", guest: 443, host: 8443 | |
if defined? VagrantPlugins::Triggers | |
# port forwarding setup and removal for running on your host primary IP address | |
config.trigger.after [:up, :reload, :provision], :stdout => true do | |
system('echo " | |
rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 | |
rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8443 | |
" | sudo pfctl -ef - >/dev/null 2>&1; echo "Add Port Forwarding (80 => 8080)\nAdd Port Forwarding (443 => 8443)"') | |
end | |
config.trigger.after [:halt, :suspend, :destroy], :stdout => true do | |
system('sudo pfctl -F all -f /etc/pf.conf >/dev/null 2>&1; echo "Removing Port Forwarding (80 => 8080)\nRemove Port Forwarding (443 => 8443)"') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Props to @speakus for condensing three lines into one. Revision made 2015-03-19