Skip to content

Instantly share code, notes, and snippets.

@suru-dissanaike
Last active August 27, 2019 10:15
Show Gist options
  • Save suru-dissanaike/5cef19a177fa8bf9dc5c66d51807c971 to your computer and use it in GitHub Desktop.
Save suru-dissanaike/5cef19a177fa8bf9dc5c66d51807c971 to your computer and use it in GitHub Desktop.
server {
listen 443 ssl;
listen [::]:443 ssl;
root /home/sudi/code/himinds-boosting-innovation-web-secure-cra/hn-app/build;
index index.html index.htm;
server_name MY_DOMAIN;
ssl_certificate /home/sudi/certbot/etc/live/MY_DOMAIN/fullchain.pem;
ssl_certificate_key /home/sudi/certbot/etc/live/MY_DOMAIN/privkey.pem;
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}
location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}
# Any route that doesn't have a file extension (e.g. /devices)
location / {
try_files $uri $uri/ /index.html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment