Last active
March 20, 2021 12:00
-
-
Save colossus21/598090557a9cc4e50bcc3c5158254624 to your computer and use it in GitHub Desktop.
NGINX CONF
This file contains hidden or 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
// static ie. frontend | |
server { | |
server_name my.domain; | |
charset utf-8; | |
root /home/ubuntu/frontend; | |
index index.html index.htm; | |
# Always serve index.html for any request | |
location / { | |
root /home/ubuntu/frontend; | |
try_files $uri /index.html; | |
} | |
} | |
// reverse proxy ie. backend service | |
server { | |
server_name service.my.domain; | |
location / { | |
proxy_pass http://127.0.0.1:8080; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allow websocket through nginx by adding:
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";