<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>letsencrypt — Simple Engineering</title>
    <link>https://getsimple.works/tag:letsencrypt</link>
    <description></description>
    <pubDate>Sun, 15 Nov 2026 00:51:38 +0000</pubDate>
    <item>
      <title>How to install an SSL certificate</title>
      <link>https://getsimple.works/how-to-install-an-ssl-certificate?pk_campaign=rss-feed</link>
      <description>As opposed to other most SSL certificate issuers, Let&#39;s encrypt is not only free to use but also easy to install and update. This write-u...</description>
      <content:encoded><![CDATA[<p><img src="https://cdn-images-1.medium.com/max/800/0*mw__iDefkSLbVuki." alt="Your encryption will need keys"/></p>

<hr/>

<p>As opposed to other most SSL certificate issuers, <em><a href="https://letsencrypt.org/getting-started/">Let&#39;s encrypt</a></em> is not only free to use but also easy to install and update. This write-up highlights steps I followed to install mine on both <a href="https://app.hoo.gy">Hoo.gy</a>.</p>

<blockquote><p>This article has complementary materials to the <strong><em><a href="http://bit.ly/2ZFJytb">Testing <code>nodejs</code> Applications book</a></em></strong>. However, the article is designed to help both those who already bought the book, as well as the wide audience of software developers  to setup working environment.  <a href="http://bit.ly/2ZFJytb"><img src="https://snap.as/a/42OS2vs.png" alt="Testing Nodejs Applications Book Cover"/></a>
<strong><em><a href="http://bit.ly/2ZFJytb">You can grab a copy of this book on this link</a></em></strong></p></blockquote>

<p>The motivation to write this article is threefold. First, this article serves as a reference for future needs, using <em><a href="https://letsencrypt.org/getting-started/">Let&#39;s encrypt</a></em>. Second, sharing experience with developer community is another form of learning. Third, as a token of appreciation to <a href="https://letsencrypt.org/isrg/">the team that democratizes</a> this core part of security infrastructure.</p>

<blockquote><p>This blog was first published under the title: <em>“How to install Let&#39;s Encypt SSL certificate on <code>ubuntu</code> and <code>nginx</code> server “</em> on <a href="https://dev.to/murindwaz/how-to-install-lets-encrypt-ssl-certificate-on-ubuntu-and-nginx-server-59h">dev.to</a> and <a href="https://medium.com/hoopeez/how-to-install-lets-encrypt-ssl-certificate-on-ubuntu-and-nginx-server-ffa363b94723">Medium</a>.</p></blockquote>

<p><strong>In this article you will learn</strong>:</p>

<p><strong>—</strong></p>
<ul><li>What are required binaries, and how to install those</li>
<li>How to generate required Keys and Certificates<br/></li>
<li>How to install certificate(s) on an <code>nginx</code> instance</li>
<li>How to enforce HTTS redirection</li>
<li>How to automate certificate (Auto-)renewal</li></ul>

<blockquote><p>Acknowledgments: To my friend and security nerd <em><a href="https://twitter.com/jc_uwimpuhwe">@jc_uwimpuhwe</a></em> for proof-reading and idea enrichments.</p></blockquote>

<h2 id="install-necessary-software">Install necessary software</h2>

<p><strong><a href="https://app.hoo.gy">Hoo.gy</a></strong> runs on <strong>Ubuntu 14 LTS</strong> Linux box located at NYC <a href="https://www.digitalocean.com/">DigitalOcean</a> datacenter. The NodeJS web server is coupled with <strong>Nginx</strong>. From this perspective, I will suppose your system runs a similar stack.</p>

<p>Certificate Issuance is done via a bot, <a href="https://certbot.eff.org/#ubuntutrusty-nginx">Certbot</a>, and covers a wide variety of Operating Systems and Web Servers. First, the step was to update and install latest packages, as well as making sure Ubuntu includes a new source of packages.</p>

<pre><code class="language-shell">$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-nginx 
</code></pre>

<p>The second step installs <a href="https://certbot.eff.org/#ubuntutrusty-nginx">certbot</a> on the box. The following command is good for Nginx server, but more can be found at <a href="https://certbot.eff.org/">eff.org</a>.</p>

<p>There are two possible modes to generate SSL certificates. That is going to be the subject of the following section.</p>

<h2 id="generate-key-and-certificate">Generate Key and Certificate</h2>

<p>The default mode is designed for regular Linux users. Everything is taken care of after you run the next command. Certbot generates proper keys+certificate and automatically update Nginx configuration files.</p>

<pre><code class="language-shell"> $ sudo certbot --nginx 
</code></pre>

<p>For more advanced users, who rather like they key+certificate, and install certificates as it pleases them, this command will help them:</p>

<pre><code class="language-shell"> $ sudo certbot --nginx certonly
</code></pre>

<p>After generating private key and certificate, in addition, you will need to <em>install certificates</em>, <em>re-enforce HTTPS redirection</em>, and to <em>automate certificate renewals</em>.</p>

<h2 id="install-certificate-s-on-nginx">Install Certificate(s) on Nginx</h2>

<p>Since you are already running Nginx in production, chances are you don&#39;t want anything to mess with your custom configurations. The second command gives you just that. There are two ways to do install certificates: first is to keep your configurations intact, and <strong>symlink</strong> new certificates. The second is obviously to change configuration links to a new location. I preferred the latter.</p>

<pre><code class="language-shell"># in /etc/nginx/sites-enabled/[your-config-file]
server{
  ...  
  listen 443 ssl;
  server_name example.com;
  ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;  
  ...
}
</code></pre>

<p>For some reasons, I was accustomed to <strong>chained.crt</strong> for certificate and <strong>key.crt</strong> for the keys. The switch is not that difficult though. Certbot generates same files under slightly different names: <strong>privatekey.pem</strong> for keys, and <strong>fullchain.pem</strong> for certificates.</p>

<h2 id="enforce-https-redirection">Enforce HTTPS redirection</h2>

<p>There is a lot of discussions on this topic. Software developers are the worst people to have a discussion with. We always end up in tribalism, and who does it better. One way that made sense in my case, was to create a new server block in existing configuration file and redirect any request to marching this new server block, to a server block that listens only to HTTPS. The new block looks somehow like the following:</p>

<pre><code class="language-shell">server{
 listen 80;
 server_name example.com www.example.com;
 
 # redirect, and rewrite all links to https://example.com 
 return 301 https://example.com$request_uri;
 
 # Alternatively: if you want to forward without rewriting requested URL 
 return 301 https://$server_name$request_uri;
}
</code></pre>

<p>Customization of nginx configuration can be a whole new topic on its own, but I cannot close this post without talking about two things: auto-renewal(using a cron job) and redirect all traffic to secure channel.</p>

<h2 id="automatic-renewal">Automatic renewal</h2>

<p>SSL certificates issues by <em><strong>Let&#39;s encrypt</strong></em> last for 90 days. Which is not a bad thing on its own. If you have 1000+ servers to update every 90 days, though ... that would be a nightmare. Whence you need some sort of automation. How to go about that, is the last topic in this blog post.</p>

<p>First of all, to renew certificate from Let&#39;s Encrypt takes a second ... if everything works according to the plan.</p>

<pre><code class="language-shell">$ sudo certbot renew --dry-run
# or simply:
# $ sudo certbot renew
# restart the nginx server
$ sudo nginx restart 
</code></pre>

<p>If you are lucky to have a smaller configuration and used auto-renewal strategy, you may have a cronjob similar to the following:</p>

<pre><code class="language-shell"># file: /etc/cron.d/certbot
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system &amp;&amp; perl -e &#39;sleep int(rand(3600))&#39; &amp;&amp; certbot -q renew
</code></pre>

<p><em>Code snippet from <a href="https://serverfault.com/a/879711">Ishigoya ~ Serverfault</a></em></p>

<p>It is possible to customize frequency, and restart command. The cronjob gives you a way to calibrate dates by using this star format: cronjob [minute, hour, the day of the month, month, the day of week].</p>
<ul><li>This cron runs every day around 5:30 server time: _30 5 * * * ... _<br/></li>
<li>This one runs same time, every bi-monthly(1st and 15th) <em>30 5 1,15 * * ...</em></li>
<li>This last one runs same time, every two months: <em>30 5 * */2 *</em></li></ul>

<p>So your cronjob may end up looking like the following if you wish to renew certificates every day around 5:30 server time.</p>

<pre><code class="language-shell">30 5 * * * certbot renew --post-hook &#34;service nginx restart&#34;
# alternatively: using systemctrl 
# 30 5 * * * certbot renew --post-hook &#34;systemctl reload nginx&#34;
</code></pre>

<p>Please consider a donation for this service to service at <a href="https://letsencrypt.org/donate/">Let&#39;s Encrypt</a>.Even though thoughts discussed in this article seems simple(not to say naive security-wise), there are enhancements done atop Let’s Encrypt foundations, that makes this choice rock solid. If you work in Containers environment, especially Kubernetes, you should check <a href="https://twitter.com/kelseyhightower">Kelsey Hightower’s</a> <a href="https://github.com/kelseyhightower/kube-cert-manager">Kube Cert Manager</a> project on Github. Netflix’s <a href="https://github.com/Netflix/lemur">Lemur</a> is another alternative to manage certificates, you can read an <a href="https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621">introductory article here</a>.</p>

<h2 id="reading-list">Reading list</h2>
<ul><li><a href="https://medium.com/should-designers-code/how-to-set-up-ssl-with-lets-encrypt-on-heroku-for-free-266c185630db">How to setup SSL Let’s Encrypt on Heroku for free</a></li>
<li><a href="https://www.exratione.com/2013/06/websockets-over-ssl-with-nodejs-and-nginx/">WebSockets Over SSL With Node.js and Nginx</a></li>
<li>More on Nginx HTTPS redirection discussions: <a href="https://serverfault.com/a/258424">1</a>, <a href="https://bjornjohansen.no/redirect-to-https-with-nginx">2</a>, <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#using-if">3</a></li>
<li><a href="https://medium.com/netflix-techblog/introducing-lemur-ceae8830f621">Introducing Lemur</a></li>
<li><a href="https://tools.ietf.org/html/rfc5915">Elliptic Curve Private Key Structure</a></li></ul>

<p><a href="https://getsimple.works/tag:nginx" class="hashtag"><span>#</span><span class="p-category">nginx</span></a> <a href="https://getsimple.works/tag:ssl" class="hashtag"><span>#</span><span class="p-category">ssl</span></a> <a href="https://getsimple.works/tag:letsencrypt" class="hashtag"><span>#</span><span class="p-category">letsencrypt</span></a> <a href="https://getsimple.works/tag:devops" class="hashtag"><span>#</span><span class="p-category">devops</span></a> <a href="https://getsimple.works/tag:HowTo" class="hashtag"><span>#</span><span class="p-category">HowTo</span></a> <a href="https://getsimple.works/tag:TestingNodejsApplications" class="hashtag"><span>#</span><span class="p-category">TestingNodejsApplications</span></a></p>
]]></content:encoded>
      <guid>https://getsimple.works/how-to-install-an-ssl-certificate</guid>
      <pubDate>Fri, 31 Jan 2020 22:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>