---
title: "Discussion on \"How we generate and renew SSL certs for arbitrary custom domains using LetsEncrypt!\" | Hashnode"
description: "Discussion on \"How we generate and renew SSL certs for arbitrary custom domains using LetsEncrypt!\". Last month we decided to do something interesting and allow Hashnode users to publish articles under a free hashnode.dev subdomain or any custom domain of their choice. It required a bit of work on our part, but the most challenging task was enabling..."
url: "https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How we generate and renew SSL certs for arbitrary custom domains using LetsEncrypt!](https://sandeep.dev/blog/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt?utm_source=hashnode&utm_medium=feed)

Last month we decided to do something interesting and allow Hashnode users to publish articles under a free hashnode.dev subdomain or any custom domain of their choice. It required a bit of work on our part, but the most challenging task was enabling...

Mar 22, 2019 · 5 min read · sandeep.dev  
Updated Nov 14, 2023  
Read the article

-   [#programming](https://hashnode.com/tag/programming)
-   [#hashnode](https://hashnode.com/tag/hashnode)
-   [#ssl](https://hashnode.com/tag/ssl)

## Written by

[Sandeep Panda](https://hashnode.com/@sandeep)

@sandeep · Bangalore

  
[View profile](https://hashnode.com/@sandeep)

co-founder, Hashnode

I am the Co-Founder of Hashnode. I write (about) code and keep interest in Venture Funding and startups. Feel free to contact me at sandeep@hashnode.com.

## Responses 10

Markdown supported · ⌘↵ to post

[Piyush Garg](https://hashnode.com/@piyushgarg-dev)

[Mar 29, 2023](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/6423f2fd31d90898059d5b72)

I have one small doubt here, I guess you are using vercel for deployments and adding domains to vercel right? Then why do you need to generate SSL certs on your own?

[Olohundare kayode](https://hashnode.com/@naskkotech)

[Jul 13, 2020](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5f0c1052c4f10b5bba43fdb1)

Thanks for this article, i was able to generate SSL for all custom domains using this tutorial

[gateclose.org](https://gateclose.org/) (a custom domain that now has SSL in it)

[nbstgloballtd.com.ng](https://nbstgloballtd.com.ng/) (the main server)

But i have a little problem, custom domains do not redirect to https by default, and for a custom domain to get data from the main server, it needs to include https, so i do have to enter https manually, pls is there anyway i can go about redirecting all custom domains to https in openresty

[Shrikar](https://hashnode.com/@girishpatil)

[Jun 30, 2020](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5efb5cfca2d02543154376f6)

Would love to read more articles like this, Thank you fro writing Sandeep. [Sandeep Panda](https://hashnode.com/@sandeep)

[Pablo García](https://hashnode.com/@kpagcha)

[Jun 23, 2020](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5ef1d213e03bbd44683daf77)

How do I check if a cert was indeed generated for an arbitrary domain? I followed this guide but it doesn't seem to be working. Also, what are the last two server blocks for? (the one with auto\_ssl:challenge\_server() and the one with auto\_ssl:hook\_server()? Are they necessary for the auto ssl certs to be generated?

[R Gadhiya](https://hashnode.com/@romit)

[Apr 21, 2020](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5e9f2e9e12892a3c760b2f46)

Thanks for such useful article.

I would appreciate if you'd look into some issues i have regarding this... [stackoverflow.com/questions/61349531/configuratio…](https://stackoverflow.com/questions/61349531/configuration-issues-multi-domain-auto-ssl-from-letscncrypt-using-openresty-l)

[Vito Botta](https://hashnode.com/@vitobotta)

[Jun 15, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5d04cb2348dcbc6f0f0f3bc7)

Hi, very useful. I am looking for some alternatives I could use with Kubernetes in an automated way, but haven't had much success so far. Perhaps I could have the app create an ingress whenever a user adds a custom domain, and let cert-manager handle the certificate for me, but I am not sure yet if this is the best approach with Kubernetes. Anyway, what I wanted to ask you is if you have run into any limits not just with LetsEncrypt, but with the OpenResty solution. How many certificates can be handled with the Lua thing and by OpenResty/Nginx itself? Would this scale to thousands or 100s of thousands users if the app is successful? If scalability is not a huge issue with this solution I might try to adapt it to Kubernetes by using SSL passthrough from ingress controller to a customised instance of OpenResty. Thanks in advance!

[sivaram](https://hashnode.com/@sivaramsi)

[May 6, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5cd039955b9d942933ceadd5)

How do you guys force a redirect to https for an arbitrary domain? Am stuck in it Facing too many redirects

```
  server {
    listen 443 ssl;
    ssl_certificate_by_lua_block {
      auto_ssl:ssl_certificate()
    }

  location / {

        proxy_pass http://localhost:4444;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
        #try_files $uri $uri/ /;        
    }
         location @rewrites {
         rewrite ^(.+)$ / last;
  }
    ssl_certificate /etc/letsencrypt/live/mydomain/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain/privkey.pem;
  }
  server {
    listen 80;
    location /.well-known/acme-challenge/ {
      content_by_lua_block {
        auto_ssl:challenge_server()
      }
    }
      location / {
         return 301 https://$host$request_uri; 
   }    
}
```

[Ramiro Berrelleza](https://hashnode.com/@ramiro)

[Mar 24, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c97dec32b0e27997ad3c85d)

If you're running in Kubernetes (or at some point decide to move this), Bitnami [recently released a runtime](https://kubeprod.io/) that automates this by using NGINX's Ingress Controller, External-DNS and Cert-Manager.

[Richard Uie](https://hashnode.com/@RichardUie)

[Mar 24, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c970144490477b87f6fee6d)

Dude, this is not merely a wonderful story of ingenuity, but a master class in how-to-investigate-and-optimize-design-for-all-stakeholders. Huzzah, HUZZAH, **HUZZAH** (three cheers)!

[sivaram](https://hashnode.com/@sivaramsi)

[Mar 22, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c94dd3b09149b515b1a15a8)

We are also using the same lua-resty-auto-ssl it works great:). By the way, there are few rate limits imposed by letsencrypt like you can create 50 certificates per week. Here you can check it out [letsencrypt.org/docs/rate-limits](https://letsencrypt.org/docs/rate-limits/) Just curious How you gonna tackle this thing?

[Sandeep Panda](https://hashnode.com/@sandeep)

[Mar 22, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c94dd3b09149b515b1a15a8#reply-5c94ed3d1e0fb7505b9b10af)

Hey Sivaram! The 50 certs/week limit is per registered domain. For example, sandeep.dev and blog.sandeep.dev — in this case the registered domain is sandeep.dev and hence is subject to 50 certs/week limit. Normally, you can create 300 new orders per 3 hours — it is highly unlikely that we will hit that limit.

[Amit Lamba](https://hashnode.com/@synaptiq)

[May 31, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c94dd3b09149b515b1a15a8#reply-5cf10b54b22b54da629d0cc3)

Can you clarify what you mean by create 300 new orders per 3 hours? What is the context?

[Amit Lamba](https://hashnode.com/@synaptiq)

[May 31, 2019](https://hashnode.com/posts/how-we-generate-and-renew-ssl-certs-for-arbitrary-custom-domains-using-letsencrypt/5c94d0771e0fb7505b9b0f59/comment/5c94dd3b09149b515b1a15a8#reply-5cf10eabbd16de1d67554e25)

Oh, I just read the LE rate limit link above. So, if I understand correctly, 300 new orders (300 registered domains) per account (hashnode account) per 3 hours translates to every 3 hours you can create 300 custom domain registration SSL certs.
