From b4ea65943e0cef6e0181285036ebcdf4422d8c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B6=80=EA=B2=BD?= Date: Fri, 12 Jul 2024 23:02:55 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20Nginx=20=ED=94=84=EB=A1=9D=EC=8B=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EC=84=A4=EC=A0=95=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nginx 설정을 수정하여 HTTPS로 연결된 서버에서 포트 8080에 위치한 백엔드 서버로 요청을 프록시하도록 변경 Fixes: TICO-215 Related to: TICO-209, TICO-161 --- .../com/tico/pomoro_do/global/config/SecurityConfig.java | 5 +---- .../tico/pomoro_do/global/controller/RootController.java | 3 +-- nginx/conf/conf.d/default.conf | 9 +++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/config/SecurityConfig.java b/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/config/SecurityConfig.java index 2c7c7ac4..9c76639a 100644 --- a/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/config/SecurityConfig.java +++ b/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/config/SecurityConfig.java @@ -35,10 +35,7 @@ public class SecurityConfig { private static final String[] swaggerURL = { "/graphiql", "/graphql", - "/swagger-ui/**", "/swagger-ui.html", - "/v3/api-docs/**", "/api-docs/**", - "/swagger-ui/index.html/**", - "/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs", "/api-docs/**" + "/swagger-ui.html", "/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**" }; // 스프링 시큐리티 기능 비활성화 ('인증','인가' 서비스 적용x) diff --git a/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/controller/RootController.java b/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/controller/RootController.java index 1d2b7091..92f276e0 100644 --- a/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/controller/RootController.java +++ b/backend/pomoro-do/src/main/java/com/tico/pomoro_do/global/controller/RootController.java @@ -10,8 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - -@Tag(name = "root", description = "애플리케이션 기본 정보 API") +@Tag(name = "Root", description = "애플리케이션 기본 정보 API") @RestController @RequiredArgsConstructor @RequestMapping("/") diff --git a/nginx/conf/conf.d/default.conf b/nginx/conf/conf.d/default.conf index 93b012ab..f37736bb 100644 --- a/nginx/conf/conf.d/default.conf +++ b/nginx/conf/conf.d/default.conf @@ -17,11 +17,16 @@ server { ssl_certificate_key /etc/letsencrypt/live/pomorodo.shop/privkey.pem; # 원하는 서비스를 제공하는 2차 라우팅 - location /api { - proxy_pass http://pomorodo.shop:8080/api; + location / { + proxy_pass http://pomorodo.shop:8080; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # /api 경로 프록시 설정 + location /api { + proxy_pass http://localhost:8080/api; + } } }