Port Number

Port 이름
80 HTTP
443 HTTPS
3000 Vue
3306 MySQL
8443 OpenVidu
9999 Jenkins
8000 apigateway
8083 wearable
8084 friend
8085 user
5000 flask

1. Nginx 설치

# Nginx 설치
sudo apt-get install nginx
# 설치 확인
sudo nginx -v
# Nginx 중지
sudo systemctl stop nginx

2. SSL 인증서 발급

**** 80 포트 열어주고 nginx중지시켜야한다.**

# Let's Encrypt 설치
sudo apt-get install letsencrypt
# 인증서 적용 및 .pem 키 발급
sudo letsencrypt certonly --standalone -d [도메인]
# 발급 경로 확인
cd /etc/letsencrypt/live/[도메인]

3. Docker 설치

sudo apt-get remove docker docker-engine docker.io containerd runc

sudo apt-get update

sudo apt-get install \\
    ca-certificates \\
    curl \\
    gnupg \\
    lsb-release

sudo mkdir -m 0755 -p /etc/apt/keyrings

curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \\
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] <https://download.docker.com/linux/ubuntu> \\
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

4. MySQL 설치

# EC2 서버 업데이트 진행
sudo apt update
# MySQL 설치
sudo apt install mysql-server
# MySQL 상태 확인
sudo systemctl status mysql
# root 계정 접속
sudo mysql -u root -p
# mysql 로 db 변경
use mysql;
# 아이디 생성
CREATE USER '아이디'@'호스트' identified with mysql_native_password by '비밀번호';
# CREATE USER 'vita'@'%' identified with mysql_native_password by 'Vita500!'
# 변경 사항 적용
FLUSH PRIVILEGES;
# 사용할 DB 생성
create database [사용할 DB 명];
# DB 생성 확인
show databases;
# root 계정 접속
GRANT ALL PRIVILEGES ON [DB스키마].[권한] to '아이디'@'호스트';
# 변경 사항 적용
FLUSH PRIVILEGES;

# 외부 접속 허용
# bind-address = 0.0.0.0
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
# MySQL 재실행
sudo service mysql restart
# 방화벽 열기
ufw allow 3306/tcp