Created
November 27, 2018 12:37
-
-
Save rajaramtt/24662c6f024e8ae81c264171bfabbe1b to your computer and use it in GitHub Desktop.
nginx angular and node proxy config
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 { | |
listen 80; | |
server_name 0.0.0.0; | |
root /var/www/html/dist; | |
index index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.html; | |
# This will allow you to refresh page in your angular app. Which will not give error 404. | |
} | |
# proxy pass | |
location /api/ { | |
proxy_pass http://127.0.0.1:4000/; | |
} | |
# Sub folder | |
location /other { | |
alias /var/other/other/dist; | |
try_files $uri /other/index.html; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WebSocket Proxy
location /xxx/xxx/ {
proxy_pass http://xx.xxx.xx:xxx/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}