Created
November 12, 2015 18:28
-
-
Save joequery/a968e9052a2fb456a7cb to your computer and use it in GitHub Desktop.
VM Port forwarding config
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
######################### | |
# On host | |
######################### | |
server{ | |
auth_basic "Restricted"; | |
auth_basic_user_file /path/to/authfile; | |
server_name "~^8(?<theport>\d{3})\.vm\.domain\.com$"; | |
location / { | |
set $baseport "8"; | |
set $fullport $baseport$theport; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $http_host; | |
proxy_set_header Vmport $fullport; | |
proxy_pass http://10.50.50.50; # private IP of VM | |
} | |
} | |
######################### | |
# On guest | |
######################### | |
server{ | |
location / { | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header Host $http_host; | |
proxy_pass http://127.0.0.1:$http_vmport; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment