Let’sencrypt + CentOS8 + nginx でサーバを無料でSSL化
既存で証明書が存在するなら削除します。
~]# sudo certbot delete -d den-tsu.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Which certificate(s) would you like to delete?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: den-tsu.net-0001
2: den-tsu.net
3: www.den-tsu.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Deleted all files relating to certificate den-tsu.net-0001.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
きれいになったことを確認します。
~]# ll /etc/letsencrypt/live/
合計 4
-rw-r--r--. 1 root root 740 5月 6 23:18 README
下記コマンドを入力します。
~]# certbot certonly \
--manual -d '*.<ここにドメイン名>' -m '<ここにメールアドレス>' \
--manual-public-ip-logging-ok \
--agree-tos \
--preferred-challenges dns-01 \
--server https://acme-v02.api.letsencrypt.org/directory
例)–manual -d '*.den-tsu.net’ -m '<ここにメールアドレス>’ \
コマンドを発行すると下記のメッセージが返ってきますので
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Please choose an account
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: vm01.sundays.dip.jp@2020-05-06T12:37:02Z (ba6d)
2: localhost.localdomain@2019-05-11T10:26:31Z (427c)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for den-tsu.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.den-tsu.net with the following value:
↑「_acme-challenge.den-tsu.net」をMyDNSのドメインDOMAIN INFOの①に入力
↓←ここに表示されている文字列をMyDNSのドメインDOMAIN INFOの②に入力
************************************
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
ここで操作はMyDNSに一時移ります(設定を入れます。)
MyDNSのDOMAIN INFOに入力が完了したらターミナルに戻って[Enter]を押して進めます。
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/den-tsu.net/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/den-tsu.net/privkey.pem
Your cert will expire on 2020-10-24. 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
[root@vm01 ~]#
あとはnginxを再起動してください。
(忘れると更新された証明書が反映されません。)