# Change a self-hosted discourse server from http to https

**URL:** https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393
**Category:** Self-hosting
**Created:** [June 18, 2022, 11:21pm UTC](https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393 "2022-06-18T23:21:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![alphonse23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alphonse23/32/106627_2.png) [@alphonse23](https://meta.discourse.org/u/alphonse23)
#### Post date: [June 18, 2022, 11:21pm UTC](https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393/1 "2022-06-18T23:21:50Z")

</div>

Hey guys,  
I have a self-hosted discourse server that I am hosting on an ec2 and I have it setup through a socket that proxies through nginx to set the domain name.

The issue I am having is that I can’t get the server to switch from `http` to `https` on emails.

Specifically for the activation email:

```plaintext
A new account was created for you at %{site_name}

Click the following link to choose a password for your new account:
%{base_url}/u/password-reset/%{email_token}

```

The `base_url` always gives the `http` version of the site, and not the `https` version, which causes an error when someone tries to use the activation email.

I thought that the setting for `base_url` would be in the `site_settings` table, so I looked and there is a row that looks like this:

```plaintext
id name data_type value created_at updated_at
18 vapid_base_url 1 http:// ***.***.com 2022-05-28 05:33:29.471814 2022-06-18 08:31:48.220973

```

but changing the `value` to `https://...` doesn’t fix the email problem.

I don’t know where the value is for `base_url`.

* * *

I also thought that maybe it was the `DISCOURSE_HOSTNAME` property in the `containers/app.yml` file, but I don’t think that is what it is. I tried changing that from a domain without the protocol, to one with it, but after a `./launcher rebuild app`, the whole discourse server goes down.

* * *

So I am asking, how do I get the site to use a `https` url in emails and not `http`. ?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 18, 2022, 11:27pm UTC](https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393/2 "2022-06-18T23:27:05Z")

</div>

See the force\_https site setting.

---

<div class="post-metadata">

### Author: ![alphonse23](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alphonse23/32/106627_2.png) [@alphonse23](https://meta.discourse.org/u/alphonse23)
#### Post date: [June 18, 2022, 11:29pm UTC](https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393/3 "2022-06-18T23:29:11Z")

</div>

okay that was it, @pfaffman thanks! You deserve a prize!

---

<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: [July 18, 2022, 11:29pm UTC](https://meta.discourse.org/t/change-a-self-hosted-discourse-server-from-http-to-https/230393/4 "2022-07-18T23:29:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
