{"id":7806,"date":"2023-09-21T05:47:14","date_gmt":"2023-09-20T20:47:14","guid":{"rendered":"https:\/\/jg7sfr.mydns.jp\/?p=7806"},"modified":"2023-09-24T09:59:47","modified_gmt":"2023-09-24T00:59:47","slug":"lets-encrypt","status":"publish","type":"post","link":"https:\/\/jg7sfr.mydns.jp\/?p=7806","title":{"rendered":"Let\u2019s Encrypt\u306a\u3069wordpress\u79fb\u884c\u306e\u624b\u9806"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">pkg search certbot<br> pkg install py39-certbot py39-certbot-apache<br>cd \/usr\/local\/etc\/letsencrypt\/live\/<br>certbot certonly &#8211;webroot -w \/usr\/local\/www\/apache24\/data\/wordpress -d jcc0413.jg7sfr.mydns.jp<br><br>Account registered.<br>Requesting a certificate for jcc0413.jg7sfr.mydns.jp<br><br>Successfully received certificate.<br>Certificate is saved at: \/usr\/local\/etc\/letsencrypt\/live\/jcc0413.jg7sfr.mydns.j \/fullchain.pem<br>Key is saved at: \/usr\/local\/etc\/letsencrypt\/live\/jcc0413.jg7sfr.mydns.j \/privkey.pem<br>This certificate expires on 2023-12-19.<br>These files will be updated when the certificate renews.<br><br>NEXT STEPS:<br>The certificate will need to be renewed before it expires. Certbot can automa ically renew the certificate in the background, but you may need to take steps o enable that functionality. See https:\/\/certbot.org\/renewal-setup for instruct ons.<br><br>vi \/usr\/local\/etc\/apache24\/extra\/httpd-ssl.conf<br>(Include\u306b\u3082\u8a2d\u7f6e\u3057\u3066\u3057\u307e\u3046\u3068\u3069\u3061\u3089\u3082\u8aad\u307f\u8fbc\u307e\u308c\u8a2d\u5b9a\u304c\u304a\u304b\u3057\u304f\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067extra\u3060\u3051\u306b\u3059\u308b)<br>(httpd.conf\u306b\u8a2d\u5b9a\u3042\u308a)<br>ServerName jcc0413.jg7sfr.mydns.jp:443<br>ServerAdmin sfrnoh@gmail.com<br>SSLCertificateFilea &#8220;\/usr\/local\/etc\/letsencrypt\/live\/jcc0413.jg7sfr.mydns.jp\/ fullchain.pem&#8221;<br>SSLCertificateKeyFile &#8220;\/usr\/local\/etc\/letsencrypt\/live\/jcc0413.jg7sfr.mydns. jp\/privkey.pem&#8221;<br><br>certbot &#8211;dry-run renew<br>echo &#8216;weekly_certbot_enable=&#8221;YES&#8221;&#8216; &gt;&gt; \/etc\/periodic.conf<br>cd \/usr\/local\/etc\/letsencrypt\/renewal-hooks\/deploy\/<br>\/etc\/periodic.conf\u306f\u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3059\u308b\u3089\u3057\u3044\u306e\u3067\u3001cron\u3092\u4f7f\u308f\u305a\u69d8\u5b50\u3092\u898b\u308b\u3053\u3068\u3068\u3059\u308b<br><br>vi reload_apache24.sh<br><em>#!\/bin\/sh<\/em><br>service `echo $0|<strong>sed<\/strong> -e &#8216;s\/.*\\\/\\(.*\\)_\\(.*\\).sh\/\\2 \\1\/&#8217;`<br>chmod 755 reload_apache24.sh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/nofu.jp\/wiki\/freebsd\/apache\/freebsd_13_apache24_certbot\">FreeBSD 13\u3068Apache 2.4\u3068certbot\u3067Let&#8217;s Encrypt! [\u306e\u3075\u51e6|NOFUDOKORO]<\/a><br>\u3053\u3061\u3089\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u3002<br><br>\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u306e\u8a8d\u8a3c\u3092\u53d7\u3051\u305f\u5f8c\u3001\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3\u304b\u3089\u30e1\u30a4\u30f3\u306b\u79fb\u884c\u3059\u308b\u305f\u3081\u306e\u51e6\u7406\uff08\u4eee<br>\u5148\u305a\u306f\u30c6\u30b9\u30c8\u7684\u306b<br>certbot certonly &#8211;force-renew &#8211;cert-name jcc0413.jg7sfr.mydns.jp -d jcc0413.jg7sfr.mydns.jp -d jg7sfr.mydns.jp &#8211;dry-run<br>cd \/usr\/local\/etc\/letsencrypt\/live\/<br>certbot certonly &#8211;dry-run &#8211;webroot -w \/usr\/local\/www\/apache24\/data\/wordpress -d jcc0413.jg7sfr.mydns.jp -d jg7sfr.mydns.jp<br><br>\u78ba\u8a8d<br>certbot certificates<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u624b\u9806\u6848<br>1.\u65e7\u30b5\u30fc\u30d0\u30fc\u3067\u8a8d\u8a3c\u3092\u5931\u52b9\u3055\u305b\u308b<br>certbot revoke &#8211;cert-path \/usr\/local\/etc\/letsencrypt\/live\/jg7sfr.mydns.jp\/fullchain.pem<br>2.\u65b0\u30b5\u30fc\u30d0\u30fc\u3067\u8a8d\u8a3c\u3092\u5f97\u308b<br>certbot revoke &#8211;cert-path \/usr\/local\/etc\/letsencrypt\/live\/jcc0413.jg7sfr.mydns.jp\/fullchain.pem<br>certbot certonly &#8211;dry-run &#8211;webroot -w \/usr\/local\/www\/apache24\/data\/wordpress -d jg7sfr.mydns.jp<br>certbot certonly &#8211;webroot -w \/usr\/local\/www\/apache24\/data\/wordpress -d jg7sfr.mydns.jp -d jg7sfr.mydns.jp<br>3.wordpress\u30a2\u30c9\u30ec\u30b9\u3068\u30b5\u30fc\u30d0\u30fc\u30a2\u30c9\u30ec\u30b9\u3092https:\/\/jg7sfr.mydns.jp\u306b\u5909\u66f4(mydns)<br>\u7ba1\u7406\u753b\u9762\u307e\u305f\u306fphpMyAdmin\u307e\u305f\u306fmysql\u30b3\u30de\u30f3\u30c9<br>phpMyAdmin\u307e\u305f\u306fmysql\u30b3\u30de\u30f3\u30c9\u3067\u4e0b\u8a184\u9805\u76ee\u5b9f\u884c<br>mysql -U *** -p<br>\u30d1\u30b9\u30ef\u30fc\u30c9\u5165\u529b<br>use ???db<br><br>UPDATE wp_options SET option_value = REPLACE(option_value, &#8216;https:\/\/jcc0413.jg7sfr.mydns.jp&#8217;, &#8216;https:\/\/jg7sfr.mydns.jp&#8217;) WHERE option_name = &#8216;home&#8217; OR option_name = &#8216;siteurl&#8217;;<br>UPDATE wp_posts SET guid = REPLACE(guid, &#8216;https:\/\/jcc0413.jg7sfr.mydns.jp&#8217;,&#8217;http:\/\/ex-new.com&#8217;);<br>UPDATE wp_posts SET post_content = REPLACE(post_content, &#8216;https:\/\/jcc0413.jg7sfr.mydns.jp&#8217;, &#8216;https:\/\/jg7sfr.mydns.jp&#8217;);<br>UPDATE wp_postmeta SET meta_value =\u3000REPLACE(meta_value,&#8217;https:\/\/jcc0413.jg7sfr.mydns.jp&#8217;,&#8217;https:\/\/jg7sfr.mydns.jp&#8217;);<br><br>4.mydns319391\u3067\u65b0\u30b5\u30fc\u30d0\u30fc\u306e\u30a2\u30c9\u30ec\u30b9\u306b\u5909\u66f4<br>\u3053\u306e\u6642\u70b9\u3067\u3001\u65b0\u65e72\u53f0\u306e\u30b5\u30fc\u30d0\u30fc\u306b\u3042\u308bmydns\u3078\u306e\u30a2\u30c9\u30ec\u30b9\u901a\u77e5\u8a2d\u5b9a\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8<br>5.mydns\u5b50ID\u524a\u9664(\u6642\u9593\u7d4c\u904e\u3067\u81ea\u52d5\u524a\u9664)<br>\u8a66\u3057\u306bmydns\u306eIP\u3060\u3051\u3092\u65b0\u65e7\u3072\u3063\u304f\u308a\u8fd4\u3057\u3066\u65b0\u306e.wordpress\u30a2\u30c9\u30ec\u30b9\u3068\u30b5\u30fc\u30d0\u30fc\u30a2\u30c9\u30ec\u30b9\u3092\u4fee\u6b63\u3057\u305f\u3060\u3051\u3067\u306f\u30c0\u30e1\u3067\u3057\u305f\u3002<br>6.httpd.conf\u3084httpd-ssl.conf\u306e\u4fee\u6b63<br>7.wordpress\u3067object cache\u3092\u5229\u7528\u3057\u3066\u3044\u308c\u3070flush(\u30ad\u30e3\u30c3\u30b7\u30e5\u524a\u9664)<br>wp-config.php\u3092\u5834\u5408\u306b\u3088\u3063\u3066\u306f\u4fee\u6b63\u3057\u5bfe\u5fdc\u3002<br>apache\u306e.htaccess\u3082\u78ba\u8a8d<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>pkg search certbot pkg install py39-certbot py39-certbot-apachecd \/usr\/local\/etc\/letsencrypt\/live\/certbot cert&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"image","meta":{"footnotes":""},"categories":[4],"tags":[423,596,403,563,599,594,597,595,598],"class_list":["post-7806","post","type-post","status-publish","format-image","hentry","category-bsd","tag-certbot","tag-certbot-certificates","tag-lets-encrypt","tag-mysql","tag-object-cache","tag-phpmyadmin","tag-replace","tag-revoke","tag-update","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/7806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7806"}],"version-history":[{"count":12,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/7806\/revisions"}],"predecessor-version":[{"id":7859,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/7806\/revisions\/7859"}],"wp:attachment":[{"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jg7sfr.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}