スポンサーリンク
こちらの記事でも書いておりますが、当ブログはLet's Encryptを使ってSSL化しております。
このLet's Encryptは無料でSSL証明書を発行してくれるので大変ありがたいのですが、期間が3ヶ月しかないため、油断するとすぐに期限切れしてしまいます。
今回はそんなお悩みを解決するため、証明書を自動更新する設定をメモしておきます。
cronの設定
# echo '0 0 * * * /usr/bin/certbot renew --post-hook "/usr/bin/systemctl restart nginx.service" > /dev/null 2>&1'
インストール時に使ったcertbotコマンドで更新できます。
コマンド
/usr/bin/certbot renew --post-hook "/usr/bin/systemctl restart nginx.service"
成功した時の実行結果
/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/blog.setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for blog.setouchino.cloud
Waiting for verification...
Cleaning up challenges
-------------------------------------------------------------------------------
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/blog.setouchino.cloud/fullchain.pem
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for www.setouchino.cloud
Waiting for verification...
Cleaning up challenges
-------------------------------------------------------------------------------
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/www.setouchino.cloud/fullchain.pem
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for setouchino.cloud
Waiting for verification...
Cleaning up challenges
-------------------------------------------------------------------------------
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/setouchino.cloud/fullchain.pem
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Congratulations, all renewals succeeded. The following certs have been renewed:
/etc/letsencrypt/live/blog.setouchino.cloud/fullchain.pem (success)
/etc/letsencrypt/live/www.setouchino.cloud/fullchain.pem (success)
/etc/letsencrypt/live/setouchino.cloud/fullchain.pem (success)
-------------------------------------------------------------------------------
ちなみにこのcertbotコマンドで更新する際、期限が残っている等の理由で更新不要の場合にはスキップします。
更新が不要な時の実行結果
# /usr/bin/certbot renew --post-hook "/usr/bin/systemctl restart nginx.service"
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/blog.setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/setouchino.cloud.conf
-------------------------------------------------------------------------------
Cert not yet due for renewal
-------------------------------------------------------------------------------
The following certs are not due for renewal yet:
/etc/letsencrypt/live/blog.setouchino.cloud/fullchain.pem (skipped)
/etc/letsencrypt/live/www.setouchino.cloud/fullchain.pem (skipped)
/etc/letsencrypt/live/setouchino.cloud/fullchain.pem (skipped)
No renewals were attempted.
No hooks were run.
-------------------------------------------------------------------------------
このため、このコマンドをcron設定しておけば必要な時だけ自動で更新してくれます。
crontabに以下のコマンドを追記します。
0 0 * * * /usr/bin/certbot renew --post-hook "/usr/bin/systemctl restart nginx.service" > /dev/null 2>&1
これで毎日0:00に更新を試みてくれます。
crontab -e
か ファイルに出力した上でcrontab "ファイル名"
で追記できます。
以上です。
スポンサーリンク
2022/05/20 21:43:25
buy modafinil pills order provigil online cheap cost provigil
2022/05/21 01:00:27
levitra 10 mg schmelztabletten levitra orosolubile costo https://xclevitradb.com/
2022/05/21 01:55:07
purchase modafinil without prescription buy modafinil 100mg online
2022/04/08 02:21:09
best research tadalafil what is cialis tadalafil 20 mg used for
2022/04/08 05:58:11
buy cheap purchase uk viagra buy viagra online viagra for sale buy viagra online no prescription
2022/04/09 12:25:17
20 mg sildenafil how fast does sildenafil work
2022/04/09 20:59:49
tadalafil dosage for ed comprar tadalafil generico
2022/04/10 08:03:26
what happens if a girl takes viagra brand name viagra
2022/04/10 08:54:38
tadalafil online buy tadalafil online
2022/04/12 02:50:16
tadalafil headache cure generic tadalafil 5mg
2022/04/13 14:35:47
pharmacy without prescription us based online pharmacy
2022/04/13 18:26:12
what are the differences between viagra cialis and levitra levitra vs viagra reviews
2022/04/15 00:09:05
pharmacy rx one Viagra with Dapoxetine
2022/04/15 10:38:51
remedies rx pharmacy discount pharmacy card
2022/04/15 19:03:39
cheap viagra 100mg canada viagra 50 mg generic
2022/04/15 21:35:53
buy generic cialis generic cialis cialis for sale on amazon
2022/04/16 19:45:45
levitra canada pharmacy canadian association of pharmacies
2022/04/16 15:56:57
best over the counter viagra pill buy viagra pharmacy
2022/04/18 04:17:22
mectizan stromectol ivermectin dosage humans
2022/04/18 12:04:58
find cheapest cialis pills generic cialis usa
2022/04/18 19:52:53
tadalafil 20 mg online tadalafil without prescription
2022/04/19 02:06:14
buy ivermectin pill ivermectin for human
2022/04/20 00:18:15
canadian discount pharmacy belleview fl Reglan
2022/04/20 03:39:55
levitra on line generic levitra 40 mg
2022/04/21 11:36:49
difference between viagra and cialis cialis one a day
2022/04/21 18:25:44
generic viagra online canada sildenafil tablet brand name in india
2022/04/22 02:46:18
us online cialis generic cialis soft tabs 20mg
2022/04/22 09:46:29
levitra 20mg filmtabletten levitra list price
2022/04/23 04:40:35
canadian pharmacy meds canadian overnight pharmacy
2022/04/23 08:12:35
stop canadian pharmacy emails pharmacy drugstore online
2022/04/24 15:55:52
canadian pharmacies lyrica canada pharmacy
2022/04/24 22:59:57
medstore online pharmacy pharmacy technician online classes
2022/04/25 07:26:46
buy viagra pharmacy 100mg online pharmacy technician jobs from home
2022/04/25 13:37:43
pharmacy online shopping direct rx pharmacy
2022/04/29 16:31:14
ivermectin pills moxidectin vs ivermectin https://stromectolujlo.com/
2022/04/29 19:56:08
levitra user reviews levitra fda https://glevitrargu.com/
2022/05/01 02:50:45
best price viagra 50 mg how much is sildenafil 50 mg https://sgiviagraikn.com/
2022/05/01 09:39:43
online pharmacy courses canada online pharmacy not requiring prescription https://dtupharmyjn.com/
2022/05/01 17:53:10
nizagara sildenafil citrate tablets sildenafil online india https://sildenafilkiol.com/
2022/05/02 00:15:44
online pharmacy pain medication Lasix https://jzpharmacyukj.com/
2022/05/03 18:54:49
purchasing viagra viagra price online india https://aviagrasbt.com/
2022/05/05 04:18:14
walmart store hours pharmacy Reforge
2022/05/05 11:45:28
generic cialis coupons buy cialis on line without presciption https://dccialisxvf.com/
2022/05/06 00:47:34
viagra v cialis v levitra levitra logo https://xclevitradb.com/
2022/05/09 13:02:29
viagra online in india brand name viagra https://aviagrasbt.com/
2022/05/09 16:16:27
levitra online cheap levitra store https://glevitrargu.com/
2022/05/10 21:38:43
best ed medication internet pharmacy mexico
2022/05/11 05:00:33
where can i buy cialis online buy cialis in las vegas https://dccialisxvf.com/
2022/05/11 12:20:35
sildenafil same as viagra sildenafil https://sildenafilkiol.com/
2022/05/11 18:03:13
levitra pe levitra interactions https://xclevitradb.com/
2022/05/13 19:53:38
dissertation editor
what is dissertation defense
dissertation writing services review
2022/05/14 18:50:04
how to take levitra for best results levitra vs cialis forum https://glevitrargu.com/
2022/05/14 19:14:07
uk dissertation writing help quotes
chicago dissertation citation
phd dissertation help
2022/05/15 02:31:16
modafinil drug provigil order online
2022/05/15 13:06:41
steps to writing a dissertation
doctoral dissertation help your
dissertation writing service
2022/05/16 01:08:22
Flexeril stat rx pharmacy
2022/05/16 12:21:22
sample dissertation
creative writing dissertation proposal
cheap dissertation writing help
2022/05/16 15:57:07
sildenafil 20 mg cost coupon for sildenafil https://sildenafilkiol.com/
2022/05/18 18:32:36
viagra tablet online viagra 20 mg coupon https://aviagrasbt.com/
2022/05/18 21:34:24
modafinil 200mg over the counter provigil oral
2022/05/18 21:55:49
when to take levitra for best results where to buy levitra online https://glevitrargu.com/
2022/05/19 12:53:43
2022/05/19 14:49:58
modafinil 100mg usa buy modafinil for sale
2022/05/20 00:39:51
writing dissertation objectives
citing a dissertation mla
online dissertation help united kingdom
2022/05/20 04:12:52
rx discount pharmacy middlesboro ky real canadian pharmacy
2022/05/20 11:11:47
buying cialis from canada buy cialis pay with paypal canada https://dccialisxvf.com/
2022/05/20 19:01:00
cipla sildenafil buy sildenafil citrate online https://sildenafilkiol.com/