server { listen 80; root /usr/share/nginx/html; index index.html; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "DENY" always; # index.html은 캐싱 금지 (배포 후 즉시 반영) location = /index.html { try_files $uri =404; add_header Cache-Control "no-store, no-cache, must-revalidate"; } # Vite 빌드 에셋 장기 캐싱 (파일명에 해시 포함 — 내용 변경 시 URL도 바뀜) location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; } # 정적 이미지 단기 캐싱 (해시 없는 파일) location /images/ { add_header Cache-Control "public, max-age=86400"; } # SPA fallback (react-router 사용 시 필요) location / { try_files $uri $uri/ /index.html; } gzip on; gzip_types text/plain text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; }