ubuntu 버전 : 20.04 LTS

mysql user

username passwd 원격 접속 가능 여부
root Commoni7b303! x
b303 Commoni7b303! o

MobaXterm ssh setting

private key : ssafy에서 받은 pem키

Untitled

저장소 세팅

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo apt-get update

[java version 8 설치]
sudo apt-get install openjdk-8-jdk

[nodejs 16.16.0 설치]
sudo curl -sL <https://deb.nodesource.com/setup_16.x> | sudo -E bash -
sudo apt-get install -y nodejs
node -v

Certbot 설치 및 SSL 설정

sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx

[SSL 설정]
sudo certbot --nginx -d i7b303.p.ssafy.io

Nginx 설정 생성

/etc/nginx default 파일 내용

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

      server_name i7b303.p.ssafy.io;
      return 301 <https://i7b303.p.ssafy.io$request-uri>;
}

server {
      listen 443 ssl;
      listen [::]:443;
      server_name i7b303.p.ssafy.io;

      ssl_certificate /etc/letsencrypt/live/i7b303.p.ssafy.io/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/i7b303.p.ssafy.io/privkey.pem;

      location / {
            root /home/ubuntu/dist;
            index index.html index.htm;
            try_files $uri $uri/ /index.html;
      }

      location /api {
            proxy_pass <http://localhost:8080>;
            proxy_redirect off;
            charset utf-8;

            proxy_set_header X-Readl-IP $remote_addr;
            proxy_set_header X-Forwarded-For @proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-NginX-Proxy true;
      }
}

서버 인스턴스 접속