From 6029101d22f8669db48a90c58640110ab028dd22 Mon Sep 17 00:00:00 2001 From: Ludovico7 Date: Mon, 2 Dec 2024 19:05:50 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20nginx=20robots.txt,=20sitemap.xml=20?= =?UTF-8?q?=EC=A0=95=EC=A0=81=ED=8C=8C=EC=9D=BC=20=ED=98=B8=EC=8A=A4?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/default.conf | 12 ++++++++++++ nginx/default.dev.conf | 10 ++++++++++ 2 files changed, 22 insertions(+) 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; # 백엔드로 요청 전달