Skip to content

Instantly share code, notes, and snippets.

@mariusbutuc
Forked from cjus/sample-nginx.conf
Last active March 14, 2017 20:37
Show Gist options
  • Save mariusbutuc/ac3a1a77111771c66482c501ccdffaeb to your computer and use it in GitHub Desktop.
Save mariusbutuc/ac3a1a77111771c66482c501ccdffaeb to your computer and use it in GitHub Desktop.
Nginx and React URL routing
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
expires 5m;
try_files $uri $uri/ /index.html;
}
location ~* \.html$ {
expires 5m;
}
location ~* "\.\w{2,4}$" {
expires 1y;
try_files $uri =404;
}
error_page 500 502 503 504 /50x.html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment