Last active
March 17, 2020 12:43
-
-
Save yusanshi/6e041397af2ce86d605e42496082ed46 to your computer and use it in GitHub Desktop.
Nginx forward to 80
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
# Forward http://127.0.0.1:8080 to example.com/ | |
# http://127.0.0.1:8081 to example.com/foo/ | |
server { | |
listen 80; | |
server_name example.com; | |
location / { | |
proxy_pass http://127.0.0.1:8080/; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "Upgrade"; | |
} | |
# The slash in proxy_pass matters, see https://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite | |
location /foo/ { | |
proxy_pass http://127.0.0.1:8081/; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "Upgrade"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment