{"id":886,"date":"2017-05-05T18:58:58","date_gmt":"2017-05-05T18:58:58","guid":{"rendered":"http:\/\/timony.com\/mickzblog\/?p=886"},"modified":"2017-05-05T20:13:36","modified_gmt":"2017-05-05T20:13:36","slug":"lets-encrypt-cert-nginx-using-a-web-proxy","status":"publish","type":"post","link":"http:\/\/timony.com\/mickzblog\/2017\/05\/05\/lets-encrypt-cert-nginx-using-a-web-proxy\/","title":{"rendered":"Let&#8217;s Encrypt Cert &#038; Nginx (Using a Web Proxy) on Centos 6.x"},"content":{"rendered":"<p>This was done on Centos 6 where prebuilt &#8216;certbot&#8217; packages are not available. On Centos 7, install &#8216;certbot&#8217; from the EPEL repo.<\/p>\n<blockquote><p>cd ~root;<br \/>\nmkdir certbot;<br \/>\nwget https:\/\/dl.eff.org\/certbot-auto;<br \/>\nchmod 755 certbot-auto;<br \/>\n.\/certbot-auto;<\/p><\/blockquote>\n<p>This installs packages, including gcc, which you may want to uninstall as it&#8217;s bad practice to have compilers on a external facing (public) Web server.<\/p>\n<p>On my server I have a different configuration file for each server we&#8217;re proxying for. These are in\u00a0\/etc\/nginx\/conf.d\/ and using a naming convention of:<\/p>\n<blockquote><p>domainname.domain.conf<\/p><\/blockquote>\n<p>For example, example.com would be:<\/p>\n<blockquote><p>example.com.conf<\/p><\/blockquote>\n<p>Edit your config file and add this after\u00a0<span class=\"s1\">location \/<\/span><span class=\"s2\"> { &#8230; } :<\/span><\/p>\n<blockquote><p>location \/.well-known {<br \/>\nalias \/tmp\/static\/.well-known;<br \/>\n}<\/p><\/blockquote>\n<p>Then:<\/p>\n<blockquote><p>mkdir \/tmp\/static\/;<\/p><\/blockquote>\n<p>Run certbot:<\/p>\n<blockquote><p>.\/certbot-auto certonly<\/p><\/blockquote>\n<p><!--more-->Selection option 2, enter your domain, then enter 1. then enter the path to the webroot as &#8216;\/tmp\/static\/&#8217;.<\/p>\n<blockquote><p>How would you like to authenticate with the ACME CA?<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>1: Spin up a temporary webserver (standalone)<\/p>\n<p>2: Place files in webroot directory (webroot)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Select the appropriate number [1-2] then [enter] (press &#8216;c&#8217; to cancel): 2<\/p>\n<p>Please enter in your domain name(s) (comma and\/or space separated) (Enter &#8216;c&#8217;<\/p>\n<p>to cancel):example.com<\/p>\n<p>Obtaining a new certificate<\/p>\n<p>Performing the following challenges:<\/p>\n<p>http-01 challenge forexample.com<\/p>\n<p>Select the webroot for example.com:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>1: Enter a new webroot<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>Press 1 [enter] to confirm the selection (press &#8216;c&#8217; to cancel): \/tmp\/static\/<\/p>\n<p>** Invalid input **<\/p>\n<p>Press 1 [enter] to confirm the selection (press &#8216;c&#8217; to cancel): 1<\/p>\n<p>Input the webroot for biogrids.org: (Enter &#8216;c&#8217; to cancel):\/tmp\/static\/<\/p>\n<p>Waiting for verification&#8230;<\/p>\n<p>Cleaning up challenges<\/p>\n<p>IMPORTANT NOTES:<\/p>\n<p>&#8211; Congratulations! Your certificate and chain have been saved at<\/p>\n<p>\/etc\/letsencrypt\/live\/biogrids.org\/fullchain.pem. Your cert will<\/p>\n<p>expire on 2017-08-03. To obtain a new or tweaked version of this<\/p>\n<p>certificate in the future, simply run certbot-auto again. To<\/p>\n<p>non-interactively renew *all* of your certificates, run<\/p>\n<p>&#8220;certbot-auto renew&#8221;<\/p>\n<p>&#8211; If you like Certbot, please consider supporting our work by:<\/p>\n<p>Donating to ISRG \/ Let&#8217;s Encrypt: https:\/\/letsencrypt.org\/donate<\/p>\n<p>Donating to EFF: https:\/\/eff.org\/donate-le<\/p><\/blockquote>\n<p>Then edit your site&#8217;s NGinx config to point to the certs, replace example.com with your domain:<\/p>\n<blockquote><p># using letsencrypt cert:<br \/>\nssl_certificate \/etc\/letsencrypt\/live\/example.com\/fullchain.pem;<br \/>\nssl_certificate_key \/etc\/letsencrypt\/live\/example.com\/privkey.pem;<\/p><\/blockquote>\n<p>Reload Nginx&#8217;s configure:<\/p>\n<blockquote><p>service nginx reload<\/p><\/blockquote>\n<p>Or on systemd systems:<\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s1\">systemctl<span class=\"Apple-converted-space\">\u00a0 <\/span>reload nginx.service <\/span><\/p>\n<\/blockquote>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This was done on Centos 6 where prebuilt &#8216;certbot&#8217; packages are not available. On Centos 7, install &#8216;certbot&#8217; from the EPEL repo. cd ~root; mkdir certbot; wget https:\/\/dl.eff.org\/certbot-auto; chmod 755 certbot-auto; .\/certbot-auto; This installs packages, including gcc, which you may want to uninstall as it&#8217;s bad practice to have compilers on a external facing (public) &hellip; <a href=\"http:\/\/timony.com\/mickzblog\/2017\/05\/05\/lets-encrypt-cert-nginx-using-a-web-proxy\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Let&#8217;s Encrypt Cert &#038; Nginx (Using a Web Proxy) on Centos 6.x<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"footnotes":""},"categories":[22,671],"tags":[692,390,693,625],"class_list":["post-886","post","type-post","status-publish","format-standard","hentry","category-linux","category-web-server","tag-letsencrypt","tag-linux","tag-nginx","tag-web-server"],"_links":{"self":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/comments?post=886"}],"version-history":[{"count":7,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/886\/revisions"}],"predecessor-version":[{"id":894,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/886\/revisions\/894"}],"wp:attachment":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/media?parent=886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/categories?post=886"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/tags?post=886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}