티스토리 뷰

⛳️ 1. apt-get 업데이트

$ sudo apt-get update -y
$ sudo apt-get upgrade -y

 

⛳️ 2. node 설치

아래 글 참고하세요
https://shunnyjang.tistory.com/8

 

[node/linux] node 설치하기

1. nvm 설치 $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash 2. 환경 변수 설정 $ export NVM_DIR="$HOME/.nvm" $ source ~/.bashrc nvm 가 잘 되는지 확인 $ nvm --version..

shunnyjang.tistory.com

 

⛳️ 3. 필요 패키지 설치

npm 업그레이드 (선택)

$ npm install -g npm@8.5.4

필요한 패키지를 설치하자

$ npm install

 

모듈을 의존성에 맞게 가장 최신으로 업데이트 하고 싶으면 아래 글 참조
https://shunnyjang.tistory.com/5

 

[npm] npm package 최신 버전 체크 및 업데이트

npm-check-updates package.json 를 의존성에 맞게 자동으로 최신 버전으로 업데이트 해주는 패키지 공식 링크 : https://www.npmjs.com/package/npm-check-updates npm-check-updates Find newer versions of dep..

shunnyjang.tistory.com

 

⛳️ 4. pm2 설치

$ npm install -g pm2

 

⛳️ 5. pm2 실행

pm2를 통해 npm start 를 데몬으로 백그라운드에서 계속 실행함

$ pm2 start npm -- start

 

⛳️ 6. nginx 설치

이제 웹서버 Nginx를 설치하자

$ sudo apt-get install nginx

 

⛳️ 7. nginx 설정

$ cd /etc/nginx/sites-available
$ sudo vi myconfig

아래 내용을 저장해준다

server {
        listen 80;
        listen [::]:80;

        access_log /var/log/nginx/reverse-access.log;
        error_log /var/log/nginx/reverse-error.log;

        location / {
                    proxy_pass http://127.0.0.1:3000;
  }
}

그리고 아래 명령어로 링크 생성

$ sudo ln -s /etc/nginx/sites-available/myconfig /etc/nginx/sites-enabled/

 

추가해준 설정이 에러 없이 잘 되는지 확인

$ sudo nginx -t

아래처럼 출력되면 이상 없이 nginx 구동 가능

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

 

nginx를 다시 재시작해준다

$ sudo systemctl restart nginx

 

배포 완료!!
참 쉽죠잉

 

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함