Skip to content

Instantly share code, notes, and snippets.

@avesus
Last active December 1, 2017 05:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avesus/68a2654a51d4214a0b0ddb47cf8c4d21 to your computer and use it in GitHub Desktop.
Save avesus/68a2654a51d4214a0b0ddb47cf8c4d21 to your computer and use it in GitHub Desktop.
Nginx perfect nodern SPA config
location /app/ {
expires max;
}
location /img/ {
expires max;
}
location = /favicon.ico {
try_files $uri =204;
}
location /api/ {
proxy_redirect off;
proxy_http_version 1.1;
proxy_pass http://nodejs;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
}
location / {
try_files '' /index.html last;
add_header Cache-Control "private, max-age=0, no-cache, no-store, must-revalidate";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment