-
-
Save salcode/da45f09ca0c319a108db to your computer and use it in GitHub Desktop.
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 | |
config.vm.network "forwarded_port", guest: 80, host: 8080 | |
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 on lo0 inet proto tcp from any to self port 80 -> 127.0.0.1 port 8080 | |
rdr pass on en0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 | |
rdr pass on en1 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080 | |
" | sudo pfctl -ef - >/dev/null 2>&1; echo "Add Port Forwarding (80 => 8080)"') | |
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)"') | |
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