server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # gzip 압축 gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; # SPA 라우팅: 모든 경로를 index.html로 location / { try_files $uri $uri/ /index.html; } # 정적 파일 캐싱 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { expires 1y; add_header Cache-Control "public, immutable"; } }