This worked for me:
location / {
alias /path/to/my/indexfile/;
try_files $uri /index.html;
}
This allowed me to create a catch-all URL for a javascript single-page app. All static files like css, fonts, and javascript built by npm run build
will be found if they are in the same directory as index.html
.
If the static files were in another directory, for some reason, you'd also need something like:
# Static pages generated by "npm run build"
location ~ ^/css/|^/fonts/|^/semantic/|^/static/ {
alias /path/to/my/staticfiles/;
}