fix: static assets MIME type and 404 handling in nginx.conf

This commit is contained in:
2026-08-07 17:39:14 +03:00
parent 1a032a4ddc
commit 64a606c438
+14 -6
View File
@@ -2,14 +2,22 @@ server {
listen 80; listen 80;
server_name _; server_name _;
location / { root /usr/share/nginx/html;
index index.html;
# Ensure proper MIME types for JavaScript, CSS, etc.
include /etc/nginx/mime.types;
# Serve static assets directly
location /assets/ {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; try_files $uri =404;
try_files $uri $uri/ /index.html; expires 30d;
add_header Cache-Control "public, no-transform";
} }
error_page 500 502 503 504 /5x.x.html; # SPA routing fallback for app routes
location = /5x.x.html { location / {
root /usr/share/nginx/html; try_files $uri $uri/ /index.html;
} }
} }