Let’s Encrypt 複数のドメインに対応したサーバー証明書を作るには?

ショコラ
ショコラ

Let’s Encrypt 複数のドメインに対応したサーバー証明書を作るには?

「certbot certonly -d {ホスト名1} -d {ホスト名2} -m {メールアドレス}」でキメマス。

もっさん先輩
もっさん先輩
certbot certonly -d {ホスト名1} -d {ホスト名2} -m {メールアドレス}

「-d {ホスト名}」を複数書きます。1つのサーバー証明書で複数のドメインに使えます。

手順

Let’s Encrypt でサーバー証明書を作る手順。

  1. nginxコンテナを起動します。
docker run -p 80:80 -it nginx bash
  1. apt-get アップデートします。
apt-get update
  1. certbotパッケージをインストールします。
apt-get install -y --no-install-recommends certbot

–-no-install-recommends
 オプション有り → 37.7 MB
 オプション無し → 61.9 MB

  1. サーバー証明書を取得します。
certbot certonly -d {ホスト名1} -d {ホスト名2} -m {メールアドレス}
# certbot certonly -d answorz.com -d answorz2.com -m mossan@answorz.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Plugins selected: Authenticator standalone, Installer None

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for answorz.com
Waiting for verification...

以上

Scroll to Top