Skip to content

Instantly share code, notes, and snippets.

@colossus21
Last active March 20, 2021 12:00
Show Gist options
  • Save colossus21/598090557a9cc4e50bcc3c5158254624 to your computer and use it in GitHub Desktop.
Save colossus21/598090557a9cc4e50bcc3c5158254624 to your computer and use it in GitHub Desktop.
NGINX CONF
// 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;
}
}
@colossus21
Copy link
Author

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";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment