JSCODE Logo
프로그래밍 과외블로그후기멘토진
회사명 : JSCODE대표 : 박재성사업자 등록번호 : 244-22-01557통신판매업 : 제 2023-인천미추홀-0381 호
학원 명칭 : 제이에스코드(JSCODE)원격학원학원설립ㆍ운영 등록번호 : 제6063호

서울특별시 구로구 경인로 20가길 11(오류동, 아델리아)

Copyright ⓒ 2025 JSCODE - 최상위 현업 개발자들의 프로그래밍 교육 All rights reserved.

이용약관개인정보처리방침
← 블로그 목록으로 돌아가기

[실습] 웹 프론트엔드 프로젝트(React + Vite) 배포하기

JSCODE 박재성
JSCODE 박재성
2025-12-06
author
JSCODE 박재성
category
Nginx
createdAt
Dec 6, 2025
series
비전공자도 이해할 수 있는 Nginx 입문/실전
slug
deploy-frontend-react-vite-with-nginx
type
post
updatedAt
Dec 6, 2025 04:47 AM

✅ 웹 프론트엔드 프로젝트(React + Vite) 배포하기

👨🏻‍🏫
이전에 웹 프론트엔드 프로젝트를 완성시켜서 Github Repository에 올려뒀다고 가정하자.
 
  1. React 프로젝트를 EC2로 가져오기
    1. $ cd /usr/share/nginx $ sudo git clone https://github.com/JSCODE-COURSE/nginx-frontend-react.git
       
  1. React 프로젝트 빌드를 위해 Node.js 설치하기
    1. $ sudo apt-get update && \ sudo apt-get install -y ca-certificates curl gnupg && \ sudo mkdir -p /etc/apt/keyrings && \ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ NODE_MAJOR=20 && \ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && \ sudo apt-get update && \ sudo apt-get install nodejs -y # Node.js가 잘 설치됐는 지 확인하기 $ node -v
       
  1. React 프로젝트 빌드하기
    1. $ cd nginx-frontend-react $ sudo npm i $ sudo npm run build
       
  1. Nginx 설정 파일 수정하기
    1. $ cd /etc/nginx/conf.d $ sudo vi default.conf
       
      /etc/nginx/conf.d/default.conf
      server { listen 80; server_name localhost; location / { root /usr/share/nginx/nginx-frontend-react/dist; index index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
       
  1. Nginx 설정 파일 반영하기
    1. # Nginx 설정 파일 중 문법 에러가 있는 지 체크 $ sudo nginx -t # Nginx의 설정 파일이 바뀐 경우 아래 명령어를 입력해줘야 설정 파일이 반영된다. $ sudo nginx -s reload
       
  1. 웹 페이지 접속해보기
    1. Nginx의 설정이 잘 적용됐는 지 http://{EC2 IP 주소} 주소로 접속해보자.
      notion image
       
       
author
JSCODE 박재성
category
Nginx
createdAt
Dec 6, 2025
series
비전공자도 이해할 수 있는 Nginx 입문/실전
slug
type
series-footer
updatedAt
Dec 6, 2025 05:04 AM
📎
이 글은 비전공자도 이해할 수 있는 Nginx 입문/실전 강의의 수업 자료 중 일부입니다.