fix: static assets MIME type and 404 handling in nginx.conf
This commit is contained in:
+14
-6
@@ -2,14 +2,22 @@ server {
|
||||
listen 80;
|
||||
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;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
try_files $uri =404;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /5x.x.html;
|
||||
location = /5x.x.html {
|
||||
root /usr/share/nginx/html;
|
||||
# SPA routing fallback for app routes
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user