Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Table of Contents


개요

Info

Let’s Encrypt SSL 인증서

  • 비용: 무료
  • 인증유효기간: 90일
  • Certbot CLI로 간단하게 인증서 발급

사전조건

Info
  • Ubuntu Server
  • DNS Service

Nginx 설치

Info
  • Ubuntu 18 버전부터 Nginx가 Default로 설치 되어 있습니다.
  • sudo systemctl status nginx 명령으로 nginx 상태를 확인 합니다.
  • curl ifconfig.me 로  NAT IP를 확인 합니다.
Code Block
linenumberstrue
sansae@sansae-ubuntu:~$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-10-08 08:56:53 UTC; 2min 10s ago
       Docs: man:nginx(8)
   Main PID: 14681 (nginx)
      Tasks: 3 (limit: 9545)
     Memory: 6.1M
     CGroup: /system.slice/nginx.service
             ├─14681 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─14682 nginx: worker process
             └─14683 nginx: worker process

Oct 08 08:56:52 sansae-ubuntu systemd[1]: Starting A high performance web server and a reverse proxy server...
Oct 08 08:56:53 sansae-ubuntu systemd[1]: Started A high performance web server and a reverse proxy server.
sansae@sansae-ubuntu:~$ curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
sansae@sansae-ubuntu:~$
sansae@sansae-ubuntu:~$ curl ifconfig.me
20.196.207.131

DNS Record 설정

Dns설정에 cert.sansae.net A Record를 추가하고, IP를 Ubuntu Server의 NAT IP(20.196.207.131)를 설정합니다.

...

추가한 Subdomain(cert.sansae.net)으로 Nginx가 서비스 되는지 확인합니다.


Certbot 설치

Info
Code Block
linenumberstrue
sudo apt update
sudo apt-get install  letsencrypt -y
sudo apt install certbot python3-certbot-nginx

인증서 발급

Info

sudo certbot --nginx -d cert.sansae.net


Info

Your certificate and chain have been saved at:
    /etc/letsencrypt/live/cert.sansae.net/fullchain.pem
Your key file has been saved at:
    /etc/letsencrypt/live/cert.sansae.net/privkey.pem

...