Skip to content

Instantly share code, notes, and snippets.

@nzvtrk
Last active October 13, 2019 21:03
Show Gist options
  • Save nzvtrk/d9cfa2eb5de7ed3c9b39c00967199c72 to your computer and use it in GitHub Desktop.
Save nzvtrk/d9cfa2eb5de7ed3c9b39c00967199c72 to your computer and use it in GitHub Desktop.
Nginx prerender-spa config
root /usr/share/nginx/html;
# default spa conf
location / {
try_files $uri $uri/ /index.html;
}
# regexp, including page folders/paths
set $pages "faq|about|choice|gift|feedback|payment|oneplusone";
# send index from appropriate folder
location ~ ^/($pages)$ {
index /usr/share/nginx/html/$1/index.html;
}
# send static from root folder
location ^~ ($pages) {
alias /usr/share/nginx/html/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment