diff --git a/nginx/default.conf b/nginx/default.conf index 769620a8..e6aa9272 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -36,6 +36,18 @@ server { # HSTS 설정 (HTTPS 강제) add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + location = /robots.txt { + root /usr/share/nginx/html; # React 빌드 결과물이 있는 디렉토리 + access_log off; + add_header Cache-Control "public, max-age=86400"; # 24시간 캐싱 + } + + location = /sitemap.xml { + root /usr/share/nginx/html; + access_log off; + add_header Cache-Control "public, max-age=86400"; + } + # /api 경로로 들어오는 요청은 백엔드로 전달 location /api { proxy_pass http://backend; # 백엔드로 요청 전달 diff --git a/nginx/default.dev.conf b/nginx/default.dev.conf index f5c8c8f7..62716b01 100644 --- a/nginx/default.dev.conf +++ b/nginx/default.dev.conf @@ -10,6 +10,16 @@ upstream frontend { server { listen 80; + location = /robots.txt { + proxy_pass http://frontend; # 개발 서버로 전달 + access_log off; + } + + location = /sitemap.xml { + proxy_pass http://frontend; + access_log off; + } + # /api 경로로 들어오는 요청은 백엔드로 전달 location /api { proxy_pass http://backend; # 백엔드로 요청 전달