Browse Source

Fix docker-nginx-config sub directory issue

pull/786/head
Dan Ditomaso 11 months ago
parent
commit
adce329895
  1. 32
      packages/web/infra/default.conf
  2. 1
      packages/web/package.json

32
packages/web/infra/default.conf

@ -3,24 +3,40 @@ server {
server_name localhost; server_name localhost;
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; index index.html;
# Serve static assets directly (hashed filenames get long cache)
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|webp|avif|svg|ttf|otf|woff|woff2|map)$ {
access_log off;
etag on;
# If you build with hashed filenames (e.g. app.abc123.js), cache hard:
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# Never cache index.html so deploys go live immediately
location = /index.html {
etag on;
add_header Cache-Control "no-cache";
}
# SPA fallback for client-side routes
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
# Basic error page (optional)
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html { internal; }
internal;
}
location ~ /\.ht { # Security hardening
deny all; location ~ /\.ht { deny all; }
}
# Gzip (works fine with your asset types)
gzip on; gzip on;
gzip_disable "msie6"; gzip_disable "msie6";
gzip_vary on; gzip_vary on;
gzip_proxied any; gzip_proxied any;
gzip_comp_level 6; gzip_comp_level 6;

1
packages/web/package.json

@ -22,6 +22,7 @@
"test": "vitest", "test": "vitest",
"ts:check": "bun run tsc --noEmit", "ts:check": "bun run tsc --noEmit",
"preview": "vite preview", "preview": "vite preview",
"docker:build": "docker build -t meshtastic-web:latest -f ./infra/Containerfile .",
"generate:routes": "bun @tanstack/router-cli generate --outDir src/ routes --rootRoutePath /", "generate:routes": "bun @tanstack/router-cli generate --outDir src/ routes --rootRoutePath /",
"package": "gzipper c -i html,js,css,png,ico,svg,json,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ ." "package": "gzipper c -i html,js,css,png,ico,svg,json,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ ."
}, },

Loading…
Cancel
Save