<p>I&&num;8217&semi;ve been playing around with let&&num;8217&semi;s encrypt and the official client available on github&period;<&sol;p>&NewLine;<div class&equals;"reposidget">&NewLine; <header class&equals;"fontello">&NewLine; <span class&equals;"fontello info"><a href&equals;"https&colon;&sol;&sol;github&period;com&sol;myst729&sol;wp-reposidget" target&equals;"&lowbar;blank">GitHub Reposidget for WordPress<&sol;a><&sol;span>&NewLine; <h2>&NewLine; <a href&equals;"https&colon;&sol;&sol;github&period;com&sol;letsencrypt">letsencrypt<&sol;a>&NewLine; <span> &sol; <&sol;span>&NewLine; <a href&equals;"https&colon;&sol;&sol;github&period;com&sol;letsencrypt&sol;letsencrypt"><strong>letsencrypt<&sol;strong><&sol;a>&NewLine; <&sol;h2>&NewLine; <&sol;header>&NewLine; <section>&NewLine; <p class&equals;"">This repository is not available anymore&period;<&sol;p>&NewLine; <p class&equals;"hidden homepage"><a href&equals;"https&colon;&sol;&sol;github&period;com&sol;letsencrypt&sol;letsencrypt"><strong>https&colon;&sol;&sol;github&period;com&sol;letsencrypt&sol;letsencrypt<&sol;strong><&sol;a><&sol;p>&NewLine; <&sol;section>&NewLine; <footer>&NewLine; <span class&equals;"fontello star">-<&sol;span><span class&equals;"fontello fork">-<&sol;span>&NewLine; <a class&equals;"hidden" href&equals;"https&colon;&sol;&sol;github&period;com&sol;letsencrypt&sol;letsencrypt&sol;archive&sol;-&period;zip">Download ZIP<&sol;a>&NewLine; <&sol;footer>&NewLine;<&sol;div>&NewLine;<p>I have to admit the client is great to automatize the process and with some tweaking can be also applied to nginx&period; But it&&num;8217&semi;s slow and you need to have python installed&period; If you use apache&comma; it will works flawlessly and is very easy to deal with&period;<&sol;p>&NewLine;<p>I decided to look for some alternative and I stumbled upon &commat;letsencrypt&period;sh<&sol;p>&NewLine;<h1>letsencrypt&period;sh<&sol;h1>&NewLine;<div class&equals;"reposidget">&NewLine; <header class&equals;"fontello">&NewLine; <span class&equals;"fontello info"><a href&equals;"https&colon;&sol;&sol;github&period;com&sol;myst729&sol;wp-reposidget" target&equals;"&lowbar;blank">GitHub Reposidget for WordPress<&sol;a><&sol;span>&NewLine; <h2>&NewLine; <a href&equals;"https&colon;&sol;&sol;github&period;com&sol;lukas2511">lukas2511<&sol;a>&NewLine; <span> &sol; <&sol;span>&NewLine; <a href&equals;"https&colon;&sol;&sol;github&period;com&sol;lukas2511&sol;letsencrypt&period;sh"><strong>letsencrypt&period;sh<&sol;strong><&sol;a>&NewLine; <&sol;h2>&NewLine; <&sol;header>&NewLine; <section>&NewLine; <p class&equals;"">This repository is not available anymore&period;<&sol;p>&NewLine; <p class&equals;"hidden homepage"><a href&equals;"https&colon;&sol;&sol;github&period;com&sol;lukas2511&sol;letsencrypt&period;sh"><strong>https&colon;&sol;&sol;github&period;com&sol;lukas2511&sol;letsencrypt&period;sh<&sol;strong><&sol;a><&sol;p>&NewLine; <&sol;section>&NewLine; <footer>&NewLine; <span class&equals;"fontello star">-<&sol;span><span class&equals;"fontello fork">-<&sol;span>&NewLine; <a class&equals;"hidden" href&equals;"https&colon;&sol;&sol;github&period;com&sol;lukas2511&sol;letsencrypt&period;sh&sol;archive&sol;-&period;zip">Download ZIP<&sol;a>&NewLine; <&sol;footer>&NewLine;<&sol;div>&NewLine;<p>If you used the official client to generate some certificate&comma; you should do the procedure to import your account private key and import your certificate before trying anything&period; This is well explained in the readme of the project&period;<&sol;p>&NewLine;<p>Considering that step done I&&num;8217&semi;ll give you what I&&num;8217&semi;ve done to make it work and automatically renew my certs&period; I also consider you have cloned the repository&period;<&sol;p>&NewLine;<h2>Set letsencrypt&period;sh<&sol;h2>&NewLine;<p>The first thing is to create 2 directories&comma; one that will hold the configuration and the certificates generate and the other to hold the challenge keys used by the protocol to verify the ownership of the domain&period;<&sol;p>&NewLine;<h3>Directories<&sol;h3>&NewLine;<pre class&equals;"brush&colon; bash&semi; title&colon; &semi; notranslate" title&equals;"">mkdir -p &sol;etc&sol;letsencrypt&period;sh&sol; &NewLine;mkdir -p &sol;var&sol;www&sol;letsencrypt&sol;&period;well-known&sol;acme-challenge&sol;<&sol;pre>&NewLine;<p>You should now move the folder <em>certs<&sol;em>&comma; the files <em>domains&period;txt&comma; config&period;sh<&sol;em> to <strong>&sol;etc&sol;letsencrypt&period;sh<&sol;strong><&sol;p>&NewLine;<h3>Configuration<&sol;h3>&NewLine;<p>I set up my configuration file this way&colon;<&sol;p>&NewLine;<pre class&equals;"brush&colon; bash&semi; title&colon; &semi; notranslate" title&equals;""> &NewLine;&num;&excl;&sol;bin&sol;bash &NewLine; &NewLine;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num; &NewLine;&num; This is the config file for letsencrypt&period;sh &num; &NewLine;&num; &num; &NewLine;&num; This file is looked for in the following locations&colon; &num; &NewLine;&num; &dollar;SCRIPTDIR&sol;config&period;sh &lpar;next to this script&rpar; &num; &NewLine;&num; &dollar;&lbrace;HOME&rcub;&sol;&period;letsencrypt&period;sh&sol;config&period;sh &lpar;in user home&rpar; &num; &NewLine;&num; &sol;usr&sol;local&sol;etc&sol;letsencrypt&period;sh&sol;config&period;sh &num; &NewLine;&num; &sol;etc&sol;letsencrypt&period;sh&sol;config&period;sh &num; &NewLine;&num; &dollar;&lbrace;PWD&rcub;&sol;config&period;sh &lpar;in current working-directory&rpar; &num; &NewLine;&num; &num; &NewLine;&num; Default values of this config are in comments &num; &NewLine;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num;&num; &NewLine; &NewLine;&num; Path to certificate authority &lpar;default&colon; https&colon;&sol;&sol;acme-v01&period;api&period;letsencrypt&period;org&sol;directory&rpar; &NewLine;&num;CA&equals;&quot&semi;https&colon;&sol;&sol;acme-v01&period;api&period;letsencrypt&period;org&sol;directory&quot&semi; &NewLine; &NewLine;&num; Path to license agreement &lpar;default&colon; https&colon;&sol;&sol;letsencrypt&period;org&sol;documents&sol;LE-SA-v1&period;0&period;1-July-27-2015&period;pdf&rpar; &NewLine;&num;LICENSE&equals;&quot&semi;https&colon;&sol;&sol;letsencrypt&period;org&sol;documents&sol;LE-SA-v1&period;0&period;1-July-27-2015&period;pdf&quot&semi; &NewLine; &NewLine;&num; Base directory for account key&comma; generated certificates and list of domains &lpar;default&colon; &dollar;SCRIPTDIR -- uses config directory if undefined&rpar; &NewLine;&num;BASEDIR&equals;&dollar;SCRIPTDIR &NewLine; &NewLine;&num; Output directory for challenge-tokens to be served by webserver or deployed in HOOK &lpar;default&colon; &dollar;BASEDIR&sol;&period;acme-challenges&rpar; &NewLine;WELLKNOWN&equals;&quot&semi;&sol;var&sol;www&sol;letsencrypt&sol;&period;well-known&sol;acme-challenge&sol;&quot&semi; &NewLine; &NewLine;&num; Location of private account key &lpar;default&colon; &dollar;BASEDIR&sol;private&lowbar;key&period;pem&rpar; &NewLine;&num;PRIVATE&lowbar;KEY&equals;&quot&semi;&dollar;&lbrace;BASEDIR&rcub;&sol;private&lowbar;key&period;pem&quot&semi; &NewLine; &NewLine;&num; Default keysize for private keys &lpar;default&colon; 4096&rpar; &NewLine;KEYSIZE&equals;&quot&semi;4096&quot&semi; &NewLine; &NewLine;&num; Path to openssl config file &lpar;default&colon; &amp&semi;lt&semi;unset&amp&semi;gt&semi; - tries to figure out system default&rpar; &NewLine;&num;OPENSSL&lowbar;CNF&equals; &NewLine; &NewLine;&num; Program or function called in certain situations &NewLine;&num; &NewLine;&num; After generating the challenge-response&comma; or after failed challenge &lpar;in this case altname is empty&rpar; &NewLine;&num; Given arguments&colon; clean&lowbar;challenge&vert;deploy&lowbar;challenge altname token-filename token-content &NewLine;&num; &NewLine;&num; After successfully signing certificate &NewLine;&num; Given arguments&colon; deploy&lowbar;cert domain path&sol;to&sol;privkey&period;pem path&sol;to&sol;cert&period;pem path&sol;to&sol;fullchain&period;pem &NewLine;&num; &NewLine;&num; BASEDIR and WELLKNOWN variables are exported and can be used in an external program &NewLine;&num; default&colon; &amp&semi;lt&semi;unset&amp&semi;gt&semi; &NewLine;&num;HOOK&equals; &NewLine; &NewLine;&num; Minimum days before expiration to automatically renew certificate &lpar;default&colon; 14&rpar; &NewLine;&num;RENEW&lowbar;DAYS&equals;&quot&semi;14&quot&semi; &NewLine; &NewLine;&num; Regenerate private keys instead of just signing new certificates on renewal &lpar;default&colon; no&rpar; &NewLine;&num;PRIVATE&lowbar;KEY&lowbar;RENEW&equals;&quot&semi;no&quot&semi; &NewLine; &NewLine;&num; E-mail to use during the registration &lpar;default&colon; &amp&semi;lt&semi;unset&amp&semi;gt&semi;&rpar; &NewLine;CONTACT&lowbar;EMAIL&equals;XXXX&commat;XXXX&period;XXX &NewLine; &NewLine;<&sol;pre>&NewLine;<p>Feel free to modify it for your need&comma; just keep in mind the use of the WELLKNOWN variable for the path of the challenge&period;<&sol;p>&NewLine;<h3>Nginx<&sol;h3>&NewLine;<p>Now the last step is to add a little snippet of code in your nginx domains&period; The basic idea is to redirect the path for the challenge to the directory we created&period;<&sol;p>&NewLine;<pre class&equals;"brush&colon; plain&semi; title&colon; &semi; notranslate" title&equals;""> &NewLine;location &Hat;~ &sol;&period;well-known&sol;acme-challenge &lbrace; &NewLine;allow all&semi; &NewLine;root &sol;var&sol;www&sol;letsencrypt&semi; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p>The allow all is there because I have a rule that forbid the access to any hidden file&sol;directory&period; This way&comma; this directory is accessible&period;<&sol;p>&NewLine;<p>And now you&&num;8217&semi;re set&comma; just follow the readme to register new domain&comma; they should get validated without problem&period; Also&comma; don&&num;8217&semi;t forget to reload your nginx after adding this snippet to your configuration&period;<&sol;p>&NewLine;