Files
teacherpick/nginx.conf
T
2026-11-10 10:12:09 +09:00

43 lines
1.2 KiB
Nginx Configuration File

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 image/svg+xml;
# 사전 렌더링된 페이지(/경로/index.html) 서빙. 정적 파일이 없는 경로는 Vue Router SPA 폴백(/index.html)
location / {
try_files $uri $uri/index.html /index.html;
add_header Cache-Control "no-cache";
}
# 관리자 화면은 색인 제외
location ~ /admin/?$ {
add_header X-Robots-Tag "noindex, nofollow";
add_header Cache-Control "no-cache";
try_files /admin/index.html =404;
}
# 해시가 붙은 빌드 산출물은 장기 캐시
location /assets/ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# 정적 미디어 캐싱
location ~* \.(jpg|jpeg|png|gif|ico|svg|mp4|webm|webp)$ {
expires 7d;
add_header Cache-Control "public, no-transform";
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}