Opendocs Logo

[Setting | Ubuntu] Nginx 설치 및 인증서 설정

우분투 환경에 Nginx를 설치하고 서비스에 인증서 세팅하는 방법을 정리한다.


작성일 : 2023-12-20
OS : Ubuntu 22.04 LTS
Nginx : 1.18.0


<1> apt update & upgrade

sudo apt update
sudo apt upgrade



<2> 이전버전 삭제

sudo apt remove nginx



<3> nginx 설치

sudo apt install nginx



<4> certbot 설치

Certbot은 HTTPS를 활성화하기 위해 수동으로 관리되는 웹사이트에서 Let’s Encrypt 인증서를 자동으로 사용하는 무료 오픈 소스 소프트웨어 도구입니다.

Certbot - Link

IMG01

Let's Encrypt - Link

IMG02

sudo apt install certbot
sudo apt install python3-certbot-nginx



<5> proxy 설정

server {
    listen       80;
    server_name  {도메인};

    location / {
        proxy_pass http://{target IP};
        proxy_set_header Host {도메인};
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}



<6> 인증서 설치

# 최초설치
certbot
# 갱신
certbot renew



<7> 인증서 자동갱신 설정

crontab -e
----------------------------------------
0 12 * * * /usr/bin/certbot renew --quiet


Tags : Nginx설치, Nginx설정, SSL설정, SSL설치, 무료인증서, certbot설치, letsencrypt설치*, _certbot설정*, letsencrypt설정*, *인증서 연장_



AD
ⓒ Opendocs. All Rights Reserved.