From 4896702ab884b621166680f9e36780da025e91d8 Mon Sep 17 00:00:00 2001 From: Hoons97 Date: Wed, 22 Jan 2025 15:56:51 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20FE=20=EC=9B=B9=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B9=8C=EB=93=9C=20=EC=8B=9C=20?= =?UTF-8?q?conf=20=ED=8C=8C=EC=9D=BC=20=EB=88=84=EB=9D=BD=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FE/Dockerfile | 4 ++-- FE/conf/nginx.conf | 9 ++++++--- FE/src/api/axiosClient.ts | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/FE/Dockerfile b/FE/Dockerfile index 9d781779..aab8479b 100644 --- a/FE/Dockerfile +++ b/FE/Dockerfile @@ -3,8 +3,6 @@ FROM node:20-alpine AS build WORKDIR /app/ -ENV VITE_BASE_URL=https://www.q-lab.site/api - COPY ./package*.json /app RUN npm config set registry https://registry.npmjs.org/ @@ -28,6 +26,8 @@ FROM nginx:alpine COPY --from=build /app/FE/dist /usr/share/nginx/html +COPY ./FE/conf/nginx.conf /etc/nginx/conf.d/default.conf + EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/FE/conf/nginx.conf b/FE/conf/nginx.conf index ccb2f3e5..8c8f1844 100644 --- a/FE/conf/nginx.conf +++ b/FE/conf/nginx.conf @@ -1,15 +1,18 @@ server { listen 80; - server_name q-lab.site www.q-lab.site; + server_name _; + # 정적 파일 serve location / { - try_files $uri /index.html; + root /usr/share/nginx/html; + index index.html; } + # 네스트 서비스 서버로 라우팅 location /api/ { - proxy_pass http://apiserver-service.default:3000/; + proxy_pass http://apiserver-service:3000/api/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/FE/src/api/axiosClient.ts b/FE/src/api/axiosClient.ts index 8bfb82fb..bfbfcba8 100644 --- a/FE/src/api/axiosClient.ts +++ b/FE/src/api/axiosClient.ts @@ -1,7 +1,7 @@ import axios from 'axios' const axiosClient = axios.create({ - baseURL: import.meta.env.VITE_BASE_URL, + baseURL: `${window.location.origin}/api`, headers: { 'Content-Type': 'application/json', },