1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Let's Encryptを用いた、SSL証明書の更新

Posted at

はじめに

AWSを用いて、自作のシステムを外部公開していたのですが、
SSL証明書の期限が月末までだったので、更新した時のメモです。
また、証明書の発行の手順も忘れていたので、付随して記入します。

筆者の状況

  • AWSでEC2を使用中
  • 独自ドメインを持っている(Route53で発行)
  • 「Let's Encrypt」でSSL証明書を発行している
    (AWS上だと、ドメイン取得費用以外に追加コストがかかることを後から知ったため。)
  • Nginxを使用中

証明書の発行

前提として、

  • 独自ドメインを持っている
  • Nginxを使用中

で進めていきます。

まずはcertbotをインストールしていきます。

Certbot(サーットボット)は、無料でSSL証明書を発行できるクライアントツールです。認証局であるLet's Encryptと連携して、SSL証明書の作成やWebサーバーの設定などを自動で行います。

# 1. 必要なパッケージのインストール
sudo dnf update -y  # まずシステムを更新

# 2. Nginxプラグイン用のリポジトリ設定
sudo dnf install -y epel-release

# 3. Certbotとそのプラグインをインストール
sudo dnf install -y certbot certbot-nginx

# インストールの確認
certbot --version

インストールが確認できたら、証明書の取得を行います。

sudo certbot --nginx -d 自分のドメイン.com

以下のようなメッセージが来ると発行完了です。
"This certificate expires on 2025-03-27."から、
「2025年3月27日までが期限だよ」ということが分かります。

Successfully received certificate.
Certificate is saved at: ~自分のドメイン.com/fullchain.pem
Key is saved at:         ~自分のドメイン.com/privkey.pem
This certificate expires on 2025-03-27.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for 自分のドメイン.com to ~
Congratulations! You have successfully enabled HTTPS on https://自分のドメイン.com

証明書の更新

次に、証明書の更新を行います。
以下のサイトで証明書の期限を見ることができるので、併せて確認してみてください。
https://www.en-pc.jp/tech/checkssl/

# 1. 有効期限の確認
sudo certbot certificates

# 2. 有効期限の更新
sudo certbot renew

更新が終わり、もう一度有効期限の確認をすると、"Expiry Date"を確認すると期限が延長されていると思うので確認して見てください。

さいごに

途中Nginxの設定で証明書が発行できなかったりしたので手こずりました。
発行や更新自体は簡単なので、ぜひ参考にしてもらえると。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?