react-spa-template/nginx.conf
2025-04-19 19:24:27 +02:00

28 lines
650 B
Nginx Configuration File

server {
listen 369;
server_name _;
root /usr/share/nginx/html;
index index.html;
absolute_redirect off;
# This is needed for path-agnostic SPA deployment
# It allows the app to be served from any base path
location / {
try_files $uri $uri/ /index.html;
}
# Handle assets with or without base path
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control "public";
try_files $uri =404;
}
# Also serve assets from the base path
location ~ ^/[^/]+/assets/ {
expires 1y;
add_header Cache-Control "public";
try_files $uri =404;
}
}