この記事について
| 環境 | apache + let’s encrypt(certbot) |
|---|---|
| 目的 | バーチャルホストに追加した新ドメインを既存のSSL証明書に反映する |
| 結果 | certbot –apache で証明書を再発行(拡張)して解決 |
つまずきポイント要約
- 証明書は元ドメインの名前のまま複数ドメイン対応になるので、certbot certificates でドメインが増えたことを確認する
- certonly の場合は設定ファイルの手動書き換えが必要
バーチャルホストに新しいドメインを追加後、既存の let’s encrypt の証明書に追加したドメインを反映させたときの作業メモ。
参考ページ
https://monmon.jp/1059/add-a-new-domain-to-lets-encrypt-and-issue-the-certificate/
やることは、元あるドメインと追加したドメインの載っている証明書を再発行させるだけ。
現在の証明書の確認
certbot certificates
証明書の発行(設定ファイルも自動書き換え)
sudo certbot --apache
もしくはこれ(設定ファイル(vhost-le-ssl.conf など)は手動での書き換えが必要)
sudo certbot certonly --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: example.com
2: example.jp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
元あるドメインと追加したドメインのふたつが表示される。どちらにも証明書を発行したいので何も入力せずにエンター。
新しい証明書に拡張(置き換える)するかと聞かれるので、E
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/example.com.conf)
It contains these names: example.com
You requested these names for the new certificate: example.jp,
example.com.
Do you want to expand and replace this existing certificate with the new
certificate?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(E)xpand/(C)ancel:
複数のドメインに対応した証明書が最初のドメイン名と同じ名前でつくられるので、ドメインが複数あることを確認する。
証明書の確認
certbot certificates
