2021年2月1日月曜日

sslをLet’s Encryptのwebrootにする。新規ドメインを新たにssl化する。

 ■サーバーのsslはすべてstandaloneからwebrootに変更済み。

下記はstandaloneからwebrootに変更したときのログ

certbot-auto certificates

certbot-auto delete --cert-name test.jp-0001

certbot-auto certificates

certbot-auto delete --cert-name test.jp

certbot-auto certonly --webroot -w /var/www/html/test.jp/public -d test.jp --agree-tos --force-renewal -n


standaloneからwebrootに変更したときの参考ページ

https://qiita.com/HeRo/items/f9eb8d8a08d4d5b63ee9


■SSL自動更新 crontab -e

5 15 * * * scl enable python27 "bash -c \"certbot-auto renew --post-hook '/sbin/service httpd restart'\"" > /var/log/certbot.log 2>&1


■今後ドメインを追加する場合もwebrootで

下記はnewsite.jpとwww.newsite.jpを追加する場合、2回に分けてやる

certbot-auto certonly --webroot -w /var/www/html/newsite.jp/public -d newsite.jp --agree-tos

certbot-auto certonly --webroot -w /var/www/html/newsite.jp/public -d www.newsite.jp --agree-tos


cd /etc/httpd/conf.d/

ll

cp ssl.www.test.jp.conf ssl.www.newsite.jp.conf

vi ssl.www.newsite.jp.conf

---

DocumentRoot "/var/www/html/newsite.jp/public"

ServerName www.newsite.jp:443

SSLCertificateFile /etc/letsencrypt/live/www.newsite.jp/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/www.newsite.jp/privkey.pem

SSLCertificateChainFile /etc/letsencrypt/live/www.newsite.jp/chain.pem

---

cp ssl.www.newsite.jp.conf ssl.newsite.jp.conf

vi ssl.newsite.jp.conf

---

DocumentRoot "/var/www/html/newsite.jp/public"

ServerName newsite.jp:443

SSLCertificateFile /etc/letsencrypt/live/newsite.jp/cert.pem

SSLCertificateKeyFile /etc/letsencrypt/live/newsite.jp/privkey.pem

SSLCertificateChainFile /etc/letsencrypt/live/newsite.jp/chain.pem

---


service httpd restart

これでhttpsでみれるか確認。

0 件のコメント:

コメントを投稿