Minecraft | EC2&Spigot 마인크래프트 서버 배포 (3): Nginx/Certbot 설정

소연·2025년 12월 25일

1. Screen으로 Spigot 백그라운드 실행

Nginx 설치 전 Spigot을 실행해 두자.

세션 생성 및 Spigot 실행:

screen -S [세션 이름]
cd minecraft
java -jar spigot-1.21.10.jar

실행 후 Ctrl+a+d 로 screen에서 빠져나온다.
이후 재진입이 필요할 시 아래 명령어를 입력하면 된다.

세션 재진입:

screen -x [세션 이름]

2. Nginx 설치&실행

Nginx 설치:

sudo yum install -y nginx
sudo systemctl start nginx
sudo systemctl enable nginx

확인:

systemctl status nginx

ㅤ
Nginx 설정:

sudo nano /etc/nginx/conf.d/tukproject.conf

nano 진입 후 아래 내용을 그대로 붙여넣자.

server {
    listen 80;
    server_name tukproject.dev;

    location / {
        proxy_pass http://localhost:25565;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

ㅤ
Nginx 리로드:

sudo nginx -t
sudo systemctl reload nginx

3. Certbot으로 SSL 발급

Certbot 설치

sudo yum install -y certbot python3-certbot-nginx

ㅤ
SSL 발급:

sudo certbot --nginx -d tukproject.dev

자동 갱신 확인:

sudo certbot renew --dry-run

ㅤ
Nginx 리로드:

sudo systemctl reload nginx

ㅤ
모든 설정이 끝나면 이제 외부에서 도메인으로 Spigot 서버를 접속할 수 있다.

0개의 댓글