Set up Let’s Encrypt with multiple domains / redirects

I just updated this as the old version no longer worked. I tested it on two sites, so I think it should be good.

3 Likes

EDIT: Found a fix, ignore all the below, but leaving here for future people. Leaving the fix at the very bottom.

Just stumbled upon this thread. So, my site is: forums.mysite.me. I have 3 domains in my NGINX config and my domain provider that I am using DNS CNAME’s for that are coming back as insecure:

mysite.me
www.mysite.me
forum.mysite.me (without the "s" if someone misspells or guesses the URL)

Do I use my base domain in the config that’s in the original post? Or how do I set it up for all 3?

after_ssl:
   # tell letsencrypt what additional certs to get
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d forums.mysite.me --keylength"
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--fullchainpath/
        to: "-d forums.mysite.me  --fullchainpath"

I’m confused because the first “replace” section has a from: /--keylength/ and the one under it has from: /--fullchainpath/. So, do I make 2 entries like that for each of those 3 URLs I listed or?..Or would it be this?

after_ssl:
   # tell letsencrypt what additional certs to get
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d mysite.me -d www.mysite.me -d forum.mysite.me --keylength"
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--fullchainpath/
        to: "-d mysite.me -d www.mysite.me -d forum.mysite.me  --fullchainpath"

^ Yes, the above box right here was the fix for multiple sites/LetsEncrypt. So excited.

1 Like

Yes. There are two different replacements in the file that need to be updated with the hostnames.

Isn’t that what the post at the top gave you when you entered the names as described?

How can we edit the OP so that it’s not confusing?

1 Like

Personally, I’d say to move that above the input box, so you see it as you’re typing.

The post gave that, yeah, but I didn’t understand it because

Why doesn’t the “of you need to add multiple domains” section that I quoted answer that?

1 Like

OK. How about this:

and then after the code to be copied, it continues:

Does that make sense?

1 Like

I think it’s just easiest to put the actual code with multiple sites as the example that I used above:

after_ssl:
   # tell letsencrypt what additional certs to get
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d mysite.me -d www.mysite.me --keylength"
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--fullchainpath/
        to: "-d mysite.me -d www.mysite.me --fullchainpath"

I think that most people will want to add only one extra domain, so my way is easier and provides a simple way to get the exact text that you need without having to make any edits to it.

Maybe it is still clear that if your site is discourse.y.com and you want certificates for discourse.y.com and y.com you need only enter y.com in the “domain2” field and click the copy icon?

In your example, if you have configured your Discourse to be mysite.com, you do not need the -d mysite.me part in your example (or if your site is www.mysite.me you need only the -d mysite.me part).

3 Likes

in what file is this code being added please?

1 Like

The code should be added to near the end of your app.yml file, in the hooks section:

3 Likes

18 posts were split to a new topic: Let’s Encrypte with multiple domains wasn’t working for ECC certs