# Setting up Let's Encrypt for multisite

**URL:** https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980
**Category:** Self-hosting
**Created:** [May 19, 2016, 5:13pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980 "2016-05-19T17:13:47Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [May 19, 2016, 5:13pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/1 "2016-05-19T17:13:47Z")

</div>

> [@Set up HTTPS support with Let's Encrypt](https://meta.discourse.org/t/set-up-https-support-with-lets-encrypt/40709/1):
>
> ⚠ Is Discourse the only website on your server?  
> If you are already using web.socketed.template.yml, because you host other websites via port 80 on the same server, stop. You should be using a Let’s Encrypt client on the host system; the validation will fail as the client used is unable to bind to unix sockets.

I’ve got three Discourse forums on this server as well as numerous other sites ([as per this howto](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013)) - any idea what the best way is for me to use lets encrypt for my discourse forums? (I’m assuming the guide in this thread won’t work?)

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [May 19, 2016, 6:12pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/2 "2016-05-19T18:12:52Z")

</div>

Should lovely Certbot from EFF help you?

> **[Certbot](https://certbot.eff.org/)**
>
> Get your site on https://

---

<div class="post-metadata">

### Author: ![precessor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/precessor/32/120664_2.png) [@precessor](https://meta.discourse.org/u/precessor)
#### Post date: [May 19, 2016, 6:36pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/3 "2016-05-19T18:36:50Z")

</div>

I saw CertBot, got me wondering if the default method for Discourse should use it. I’m no expert on this though. Any experts like to comment?

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [May 19, 2016, 7:07pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/4 "2016-05-19T19:07:11Z")

</div>

This guide shows the complete automation method. ACME is well supported by Let’s Encrypt. You don’t need to worry about it **at all**. Implementation may come and go, all you need is using this template

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [May 19, 2016, 7:09pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/5 "2016-05-19T19:09:10Z")

</div>

@AstonJ are you running them as multi-site? If so, you might be able to still use this how-to, you just might have to alter the letsencrypt template to pass multiple domains.

If they are separate containers, you can simply use the template as is.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [May 20, 2016, 3:24am UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/6 "2016-05-20T03:24:35Z")

</div>

@AstonJ I would just do it manually using [GitHub - acmesh-official/acme.sh: A pure Unix shell script ACME client for SSL / TLS certificate automation · GitHub](https://github.com/Neilpang/acme.sh) or whichever client of your choice. I helped a friend yesterday and it took me about 10 mins to get it done.

---

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [May 20, 2016, 11:38am UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/7 "2016-05-20T11:38:33Z")

</div>

@cpradio yep my instances are separate containers 🙂

With that in mind, do you still advise against using the template as per the first post @tgxworld?

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [May 20, 2016, 4:05pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/8 "2016-05-20T16:05:40Z")

</div>

That depends on your setup. If you have Apache/Nginx, always manage your certificate by yourself. So short answer is no. I have similar setup. Two container for production. One for a multi site. I uses the script and manage all those certificates.

---

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [May 20, 2016, 5:04pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/9 "2016-05-20T17:04:10Z")

</div>

I’ve got:

-------------\> Sends request to a container if a discourse site/domain (all using separate containers)  
HAProxy  
-------------\> Sends all other requests to Apache as usual

---

<div class="post-metadata">

### Author: ![fuerst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fuerst/32/120729_2.png) [@fuerst](https://meta.discourse.org/u/fuerst)
#### Post date: [June 17, 2016, 9:35am UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/10 "2016-06-17T09:35:42Z")

</div>

I recommend using [Nginx Proxy](https://github.com/jwilder/nginx-proxy) together with the [LetsEncrypt companion container for nginx-proxy](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion). This setup allows me to run many containerized web apps at ports 80 or 443 as well as automatic certificate renewal.

Besides starting both containers the only configuration you need is to add 3 environment variables to a Docker container. Example for Discourse (in _/var/discourse/containers/app.yml_):

```plaintext
  DISCOURSE_HOSTNAME: 'discourse.mydomain.tld'
  VIRTUAL_HOST: 'discourse.mydomain.tld'
  LETSENCRYPT_HOST: 'discourse.mydomain.tld'
  LETSENCRYPT_EMAIL: 'your_mailbox@mydomain.tld'

```

Nginx Proxy needs the containers to expose their port to be proxied which you do like this in your app.yml:

```plaintext
expose:
  - "80" # fwd host port 80 to container port 80 (http)

```

---

<div class="post-metadata">

### Author: ![shri](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shri/32/197750_2.png) [@shri](https://meta.discourse.org/u/shri)
#### Post date: [July 16, 2016, 2:07am UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/11 "2016-07-16T02:07:13Z")

</div>

> [@fuerst](#):
>
> I recommend using Nginx Proxy together with the LetsEncrypt companion container for nginx-proxy. This setup allows me to run many containerized web apps at ports 80 or 443 as well as automatic certificate renewal.

@fuerst - so, let me see if I got this correct.

- You have a data container for redis / pgsql
- You have a multisite web\_only type container for your websites say [abc.com](http://abc.com), [def.com](http://def.com) and [xyz.com](http://xyz.com) with SSL and letsencrypt templates being used.

You then optionally have a VM which runs nginx\_proxy and the letsencrypt companion container and these proxy to the web\_only container?

I really don’t want to complicate my install so much. Would love to see a web\_only multisite which supports letsencrypt for the domains. I’ll look at the templates / yml file .. should not be rocket science as we do this day in and day out on nginx for php based apps, without docker.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 12, 2019, 7:28pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/12 "2019-02-12T19:28:53Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 4, 2022, 11:53pm UTC](https://meta.discourse.org/t/setting-up-lets-encrypt-for-multisite/44980/13 "2022-03-04T23:53:52Z")

</div>


