Files
gomoku/client/nginx.conf
T
tiennm99 b2be88597c feat(docker): multi-stage Dockerfiles and compose for server + nginx client
- server/Dockerfile: golang:1.23-alpine build → distroless/static-debian12:nonroot (3.5 MB)
- client/Dockerfile: node:22-alpine Vite build → nginx:1.27-alpine runtime
- client/nginx.conf: SPA fallback, aggressive asset caching, gzip
- docker-compose.yml: two services — server :1999, client :8080
- server/.dockerignore / client/.dockerignore: trim build contexts
- server/Makefile: add docker-build/run/stop/logs/smoke targets
- client/vite.config.js: raise chunkSizeWarningLimit to 2000 (Phaser bundle)
- remove server/docker-compose.yaml (superseded by root compose file)
2026-04-11 15:28:15 +07:00

29 lines
843 B
Nginx Configuration File

server {
listen 8080;
server_name _;
root /usr/share/nginx/html;
index index.html;
# SPA routing — serve index.html for any route not matching a real file
location / {
try_files $uri $uri/ /index.html;
}
# Aggressively cache hashed assets (Vite appends content hash to filenames)
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Never cache index.html so the browser always picks up new asset hashes
location = /index.html {
expires off;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# Gzip text assets — Phaser JS bundle compresses well (~364 KB gzipped vs 1.6 MB raw)
gzip on;
gzip_types application/javascript application/json text/css text/html;
gzip_min_length 1024;
}