You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
# Nginx SPA fallback for baskbuddy.com
|
|
# Drop this snippet into your server {} block and set root to the dist/ folder.
|
|
|
|
server {
|
|
listen 80;
|
|
server_name baskbuddy.com www.baskbuddy.com;
|
|
root /var/www/baskbuddy/dist;
|
|
index index.html;
|
|
|
|
# gzip for SPA assets
|
|
gzip on;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
|
|
# static assets (fonts, images, videos, og images, sitemap, robots)
|
|
location ~* \.(?:webp|png|jpg|jpeg|mp4|webm|svg|ico|woff2?|css|js|xml|txt)$ {
|
|
expires 6M;
|
|
access_log off;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# hashed Vite assets live under /assets/ with content-hash filenames
|
|
location /assets/ {
|
|
expires 1y;
|
|
access_log off;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# all other routes fall back to index.html for React Router
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
|
|
# HTTPS (recommended) — after obtaining a certificate, proxy/redirect from 443:
|
|
# server {
|
|
# listen 443 ssl http2;
|
|
# server_name baskbuddy.com www.baskbuddy.com;
|
|
# root /var/www/baskbuddy/dist;
|
|
# include /path/to/ssl.conf;
|
|
# location / { try_files $uri $uri/ /index.html; }
|
|
# }
|
|
|