Created
July 5, 2013 15:30
-
-
Save anonymous/5935312 to your computer and use it in GitHub Desktop.
nginx configuration for host redirects. Allows me to type "int" or "myd" on any browser on my workstation or otherwise (as long as the entries pointing to my workstation are in the hosts file), and it'll redirect me to the correct address and port for that app.
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
server { | |
if ($host = 'int') { | |
set $test I; | |
} | |
if ($host = 'myd') { | |
set $test M; | |
} | |
if ($remote_addr = '127.0.0.1') { | |
set $test '${test}L'; | |
} | |
if ($remote_addr != '127.0.0.1') { | |
set $test '${test}R'; | |
} | |
if ($test = IL) { | |
rewrite ^(.*)$ http://localhost:5050$1 break; | |
} | |
if ($test = IR) { | |
rewrite ^(.*)$ http://10.0.40.150:5050$1 break; | |
} | |
if ($test = ML) { | |
rewrite ^(.*)$ http://localhost:5051$1 break; | |
} | |
if ($test = MR) { | |
rewrite ^(.*)$ http://10.0.40.150:5051$1 break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment