반응형
1. Node.js 및 npm 설치하기
# Ubuntu 기준
sudo apt update
sudo apt install nodejs npm -y
# 버전 확인
node -v
npm -v
2. Vite 기반 React 프로젝트 생성
npm create vite@latest my-app -- --template react
cd my-app
3. 패키지 설치
cd my-app
npm install
4. 개발서버 실행
npm run dev
5. 기본 접속 확인
- http://localhost:5173/
6. 정적 배포용 빌드
npm run build
7. NginX 설치
# nginx 설치
sudo apt install nginx
# 설치 확인
sudo systemctl status nginx
# 기본 설정파일 편집
sudo vi /etc/nginx/sites-available/default
# nginx 재시작
sudo nginx -t # 설정 문법 검사
sudo systemctl reload nginx
8. NginX를 통한 배포
sudo cp -r dist/* /var/www/html/
반응형
'프로그래밍 > React' 카테고리의 다른 글
리액트(React) 시작하기 2 (0) | 2025.05.22 |
---|