{"id":14859,"date":"2017-08-25T10:39:28","date_gmt":"2017-08-25T01:39:28","guid":{"rendered":"https:\/\/sys-guard.com\/?p=14859"},"modified":"2017-08-26T21:40:40","modified_gmt":"2017-08-26T12:40:40","slug":"lets-encrypt%e3%81%a7ssl%e5%8c%96-nginx%e3%81%ab%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"https:\/\/sys-guard.com\/post-14859\/","title":{"rendered":"Let&#8217;s Encrypt\u3067SSL\u5316! Nginx\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14863img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/08\/letsenctrypt_20170825_3.jpg\" alt=\"Let's Encrypt\" width=\"680\" height=\"338\" \/><\/p>\n<p>@see\u00a0<a href=\"https:\/\/letsencrypt.org\/\" target=\"_blank\" rel=\"noopener\">https:\/\/letsencrypt.org\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u7121\u6599\u306e\u30c9\u30e1\u30a4\u30f3\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3067\u304d\u308bLet&#8217;s Encypt\u306e\u5229\u7528\u624b\u9806\u306eTips\u3067\u3059\u3002<\/p>\n<blockquote><p><strong>Let&#8217;s Encrypt<\/strong><\/p>\n<p>\u3059\u3079\u3066\u306e<a title=\"Web\u30b5\u30fc\u30d0\" href=\"https:\/\/ja.wikipedia.org\/wiki\/Web%E3%82%B5%E3%83%BC%E3%83%90\">Web\u30b5\u30fc\u30d0<\/a>\u3078\u306e\u63a5\u7d9a\u3092\u6697\u53f7\u5316\u3059\u308b\u3053\u3068\u3092\u76ee\u6307\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b<sup id=\"cite_ref-4\" class=\"reference\"><a href=\"https:\/\/ja.wikipedia.org\/wiki\/Let%27s_Encrypt#cite_note-4\">[4]<\/a><\/sup>\u3002\u652f\u6255\u3044\u3001\u30b5\u30fc\u30d0\u8a2d\u5b9a\u3001\u30e1\u30fc\u30eb\u306b\u3088\u308b\u78ba\u8a8d\u3001\u8a3c\u660e\u66f8\u306e\u66f4\u65b0\u3068\u3044\u3063\u305f\u4f5c\u696d\u3092\u7701\u7565\u3059\u308b\u3053\u3068\u3067\u3001TLS\u6697\u53f7\u5316\u306b\u304a\u3051\u308b\u8a2d\u5b9a\u3084\u4fdd\u5b88\u306e\u8907\u96d1\u3055\u3092\u5927\u5e45\u306b\u524a\u6e1b\u3059\u308b\u3053\u3068\u3092\u610f\u56f3\u3057\u3066\u3044\u308b<sup id=\"cite_ref-ZDNet20141109_5-0\" class=\"reference\"><a href=\"https:\/\/ja.wikipedia.org\/wiki\/Let%27s_Encrypt#cite_note-ZDNet20141109-5\">[5]<\/a><\/sup>\u3002<a title=\"Linux\" href=\"https:\/\/ja.wikipedia.org\/wiki\/Linux\">Linux<\/a>\u306eWeb\u30b5\u30fc\u30d0\u30fc\u3067\u306f\u3001<a title=\"HTTPS\" href=\"https:\/\/ja.wikipedia.org\/wiki\/HTTPS\">HTTPS<\/a>\u306e\u6697\u53f7\u5316\u306e\u8a2d\u5b9a\u304a\u3088\u3073\u8a3c\u660e\u66f8\u306e\u5165\u624b\u30fb\u66f4\u65b0\u304c\u308f\u305a\u304b2\u3064\u306e\u30b3\u30de\u30f3\u30c9\u306b\u3088\u3063\u3066\u53ef\u80fd\u3067\u3042\u308b<\/p>\n<p>@see <a href=\"https:\/\/ja.wikipedia.org\/wiki\/Let%27s_Encrypt\" target=\"_blank\" rel=\"noopener\">Let&#8217;s Encrypt<\/a><\/p><\/blockquote>\n<p>\u5e38\u6642SSL\u5316\u306a\u3069\u3001SSL\u306e\u30b5\u30a4\u30c8\u304c\u5f53\u305f\u308a\u524d\u306b\u306a\u3063\u3066\u304d\u307e\u3057\u305f\u3002\u30b5\u30fc\u30d0\u8a3c\u660e\u66f8\u306f\u5b89\u3044\u3082\u306e\u30671,000\u5186\u3001\u9ad8\u3044\u3082\u306e\u3060\u3068\u6570\u5341\u4e07\u3057\u307e\u3059\u304c\u3001Let&#8217;s Encrypt\u3092\u5229\u7528\u3059\u308b\u3068\u7121\u6599\u3067\u30c9\u30e1\u30a4\u30f3\u8a3c\u660e\u66f8\u3092\u5165\u624b\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>Certbot\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<pre class=\"lang:default decode:true\"># cd \/usr\/local\/src<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \"># git clone https:\/\/github.com\/certbot\/certbot<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \"># cd certbot\/<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \"># .\/certbot-auto -n\r\n\r\nComplete!\r\nCreating virtual environment...\r\nInstalling Python packages...\r\nInstallation succeeded.\r\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\r\nMissing command line flags. For non-interactive execution, \r\nyou will need to specify a plugin on the command line.  \r\nRun with '--help plugins' to see a list of options, \r\nand see https:\/\/eff.org\/letsencrypt-plugins for more detail on what the plugins do and how to use them.\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>\u8a3c\u660e\u66f8\u306e\u4f5c\u6210<\/h4>\n<pre class=\"lang:default decode:true \"># .\/certbot-auto certonly --standalone -d example.com,www.example.com -m postmaster@example.com --agree-tos -n\r\n\r\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\r\nObtaining a new certificate\r\nPerforming the following challenges:\r\ntls-sni-01 challenge for example.com\r\ntls-sni-01 challenge for www.example.com\r\nCleaning up challenges\r\nProblem binding to port 443: Could not bind to IPv4 or IPv6.<\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li>-d \u30c9\u30e1\u30a4\u30f3\u540d<br \/>\n-d example.com, www.example.com\u306a\u3069www\u3042\u308a\u306a\u3057\u306b\u8907\u6570\u5bfe\u5fdc\u51fa\u6765\u307e\u3059\u3002<\/li>\n<li>-m \u9023\u7d61\u7528\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>\u554f\u984c\u767a\u751f<\/h2>\n<blockquote><p>Problem binding to port 443: Could not bind to IPv4 or IPv6.<\/p><\/blockquote>\n<p>Nginx\u8d77\u52d5\u4e2d\u306f\u8a8d\u8a3c\u304c\u672a\u3060\u306b\u51fa\u6765\u306a\u3044\u6a21\u69d8\u306a\u306e\u3067\u3059\u3088\u306d&#8230;\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>Nginx\u3092\u3068\u3081\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \"># systemctl stop nginx<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8a3c\u660e\u66f8\u306e\u8a8d\u8a3c<\/p>\n<pre class=\"lang:default decode:true \"># .\/certbot-auto certonly --standalone -d example.com,www.example.com -m postmaster@example.com --agree-tos -n\r\n\r\n\r\nSaving debug log to \/var\/log\/letsencrypt\/letsencrypt.log\r\nObtaining a new certificate\r\nPerforming the following challenges:\r\ntls-sni-01 challenge for sys-guard.com\r\ntls-sni-01 challenge for www.sys-guard.com\r\nWaiting for verification...\r\nCleaning up challenges\r\n\r\nIMPORTANT NOTES:\r\n - Congratulations! Your certificate and chain have been saved at:\r\n   \/etc\/letsencrypt\/live\/sys-guard.com\/fullchain.pem\r\n   Your key file has been saved at:\r\n   \/etc\/letsencrypt\/live\/example.com\/privkey.pem\r\n   Your cert will expire on 2017-11-22. To obtain a new or tweaked\r\n   version of this certificate in the future, simply run certbot-auto\r\n   again. To non-interactively renew *all* of your certificates, run\r\n   \"certbot-auto renew\"\r\n - If you like Certbot, please consider supporting our work by:\r\n\r\n   Donating to ISRG \/ Let's Encrypt:   https:\/\/letsencrypt.org\/donate\r\n   Donating to EFF:                    https:\/\/eff.org\/donate-le<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8d77\u52d5\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\"># systemctl start nginx<\/pre>\n<p>&nbsp;<\/p>\n<p>\u8a3c\u660e\u66f8\u304c\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \"># ls -laht \/etc\/letsencrypt\/live\/example.com\/\r\n\r\ntotal 12K\r\ndrwxr-xr-x 2 root root 4.0K Aug 24 18:56 .\r\n-rw-r--r-- 1 root root  543 Aug 24 18:56 README\r\ndrwx------ 3 root root 4.0K Aug 24 18:56 ..\r\nlrwxrwxrwx 1 root root   37 Aug 24 18:56 cert.pem -&gt; ..\/..\/archive\/example.com\/cert1.pem\r\nlrwxrwxrwx 1 root root   38 Aug 24 18:56 chain.pem -&gt; ..\/..\/archive\/example.com\/chain1.pem\r\nlrwxrwxrwx 1 root root   42 Aug 24 18:56 fullchain.pem -&gt; ..\/..\/archive\/example.com\/fullchain1.pem\r\nlrwxrwxrwx 1 root root   40 Aug 24 18:56 privkey.pem -&gt; ..\/..\/archive\/example.com\/privkey1.pem<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Nginx\u306e\u8a2d\u5b9a\u7b87\u6240\u306bLets Encrypt\u8a3c\u660e\u66f8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true\">        ssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;\r\n        ssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;\r\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\"># nginx -t<\/pre>\n<pre class=\"lang:default decode:true\"># systemctl reload nginx<\/pre>\n<p>\u3053\u308c\u3067\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u53cd\u6620\u3055\u308c\u305f\u304b\u3092\u898b\u3066\u307f\u3088\u3046\u3002<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14861img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/08\/letsenctrypt_20170825_1_2.jpg\" alt=\"Let's Encrypt\" width=\"663\" height=\"328\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Let&#8217;s Encrypt\u306f90\u65e5\u4ee5\u5185\u306b\u66f4\u65b0\u304c\u5fc5\u8981\u3067\u3059\uff01<\/h2>\n<p>Cron\u3092\u4f7f\u3063\u3066\u81ea\u52d5\u5316\u3057\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u66f4\u65b0\u306e\u81ea\u52d5\u5316<\/p>\n<pre class=\"lang:default decode:true\"># vi \/etc\/crontab\r\n\r\n0 4 1 * * root \/bin\/systemctl stop nginx &amp;&amp; \/usr\/local\/src\/certbot\/certbot-auto renew --force-renewal &amp;&amp; \/bin\/systemctl start nginx<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \"># systemctl restart crond<\/pre>\n<p>&nbsp;<\/p>\n<p>\u554f\u984c\u304c\u3042\u3063\u3066\u3001\u8a3c\u660e\u66f8\u306e\u66f4\u65b0\u306e\u6bce\u306b10\uff5e15\u79d2WEB\u30b5\u30fc\u30d3\u30b9\u3092\u843d\u3068\u3055\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>Let&#8217;s Encrypt\u304c\u4f7f\u3048\u308b\u30b1\u30fc\u30b9<\/h2>\n<p><strong>\u6708\u306b1\u56de20\u79d2\u3050\u3089\u3044\u843d\u3061\u3066\u3082\u5e73\u6c17\u3002<\/strong><\/p>\n<p>\u500b\u4eba\u30d6\u30ed\u30b0\u3084\u8da3\u5473\u306e\u30b5\u30a4\u30c8\u306a\u3069\u8a31\u5bb9\u3067\u304d\u308b\u5834\u5408\u306fLet&#8217;s Encrypt\u306e\u6069\u6075\u3092\u53d7\u3051\u308b\u3053\u3068\u306f\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>\u8a31\u5bb9\u3067\u304d\u306a\u3044\u306e\u3067\u3001GeoTrust\u306b\u623b\u3057\u307e\u3059\u3002<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14862img-responsive\" src=\"https:\/\/sys-guard.com\/contents\/wp-content\/uploads\/2017\/08\/letsenctrypt_20170825_2.jpg\" alt=\"Let's Encrypt\" width=\"653\" height=\"324\" \/><\/p>\n<p>\u3084\u306f\u308a\u66f4\u65b0\u6bce\u306b\u4f1a\u793e\u306e\u30b5\u30a4\u30c8\u304c10\u79d2\u7a0b\u843d\u3061\u308b\u306e\u306f\u8a31\u5bb9\u3067\u304d\u308b\u304b&#8230;\u3002\u4e00\u756a\u30a2\u30a6\u30c8\u306a\u306e\u306fNginx\u304c\u7acb\u3061\u4e0a\u304c\u308a\u306b\u5931\u6557\u3057\u3066\u9577\u6642\u9593\u843d\u3061\u3063\u3071\u306a\u3057\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u30b1\u30fc\u30b9\u304c\u60f3\u5b9a\u3055\u308c\u308b\u306e\u306f\u307e\u305a\u3044\u3002<\/p>\n<p>\u4eca\u56de\u306fGeoTrust\u306e\u8a3c\u660e\u66f8\u306b\u623b\u3057\u307e\u3057\u305f\u3002Nginx\u3092\u6b62\u3081\u305a\u306bLet&#8217;s Encrypt\u304c\u8a8d\u8a3c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u4fdd\u7559\u304b\u306a\uff1f<\/p>\n<p>&nbsp;<\/p>\n<p>\u304a\u75b2\u308c\u69d8\u3067\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>@see\u00a0https:\/\/letsencrypt.org\/ &nbsp; \u7121\u6599\u306e\u30c9\u30e1\u30a4\u30f3\u8a3c\u660e\u66f8\u3092\u53d6\u5f97\u3067\u304d\u308bLet&#8217;s Encypt\u306e\u5229\u7528\u624b\u9806\u306eTips\u3067\u3059\u3002 Let&#8217;s Encrypt \u3059\u3079\u3066\u306eWeb\u30b5\u30fc\u30d0\u3078\u306e\u63a5\u7d9a\u3092\u6697\u53f7\u5316\u3059\u308b [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":14864,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[125],"_links":{"self":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts\/14859"}],"collection":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/comments?post=14859"}],"version-history":[{"count":0,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/posts\/14859\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/media\/14864"}],"wp:attachment":[{"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/media?parent=14859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/categories?post=14859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sys-guard.com\/wp-json\/wp\/v2\/tags?post=14859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}