Skip to content

Instantly share code, notes, and snippets.

@yusanshi
Last active March 17, 2020 12:43
Show Gist options
  • Save yusanshi/6e041397af2ce86d605e42496082ed46 to your computer and use it in GitHub Desktop.
Save yusanshi/6e041397af2ce86d605e42496082ed46 to your computer and use it in GitHub Desktop.
Nginx forward to 80
# 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