certbotでマルチドメインを設定する

ieserverを使ってwspri.dip.jpのDDNSドメインを長年使わせていただいてきましたが、不安定で繋がったり繋がらなかったりの状態が続いていましたのでwspri.plusload.netを作り、ドメインをこちらに移行してDDNSではそのままwspri.dip.jpで、通常のDNSではwspri.plusload.netで接続できるように並行して運用します。

ですのでドメインのSSL化もマルチドメイン化しました。

まず、本家のこちらを参考にcertbotをアンインストールします。httpdの種類とOSを選択すると手順が表示されます。

この手順を行う前に一旦証明書関連一式を削除しておきます。

sudo certbot delete --cert-name wspri.dip.jp

wspri.dip.jpのところはSSLで使用している現状のドメインを指定します。

そしたら手順1,2,3,4まで進めます。そのまますべてやっちゃうとダメですのでご注意ください。

certbotのインストールが終わったら確認します。

certbot --version
certbot 1.8.0

こんな感じで表示されたらちゃんとインストールできてます。

確認出来たらマルチドメイン証明書を発行します。

sudo certbot certonly --webroot -w /home/ubuntu -d wspri.plusload.net -d wspri.dip.jp

このサーバのドメインはDDNSのwspri.dip.jpとDNSのwspri.plusload.netの両方を利用していますのでこの両方のドメインを指定します。

注意!

証明書の発行に失敗し何度も繰り返すと以下の警告が表示され証明書の発行ができなくなります。

An unexpected error occurred:
There were too many requests of a given type :: Error creating new order :: too many failed authorizations recently: 
see https://letsencrypt.org/docs/rate-limits/
これが出るとしばらく証明書の発行ができなくなります。出たらあきらめて明日の作業に繰り越ししましょう。
成功するとこのようなメッセージが出ます。
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/wspri.plusload.net/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/wspri.plusload.net/privkey.pem
Your cert will expire on 2020-12-16. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

確認出来たらhttpdの設定ファイルを修正します。

sudo vi /etc/apache2/sites-available/default-ssl.conf

 # SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/wspri.plusload.net/fullchain.pem
#SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/letsencrypt/live/wspri.plusload.net/privkey.pem
#SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

SSLCertificateFileのパスとSSLCertificateKeyFileのパスを修正します。

修正したらhttpdの再起動してください。

sudo systemctl restart apache2

エラーが出なければこれでOKです。

https://wspri.dip.jp(http://wspri.dip.jp)

https://wspri.plusload.net(http://wspri.plusload.net)

どちらでも同じサーバに接続できます。

 

 

コメントを残す

メールアドレスが公開されることはありません。必須項目には印がついています *

CAPTCHA


日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)