# Unable to Enable HTTPS and Change Port in Mattermost Omnibus Deployment

**URL:** <https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595>\
**Category:** Troubleshooting\
**Created:** [April 5, 2023, 6:08pm UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595 "2023-04-05T18:08:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taiki](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/taiki/32/6657_2.png) [@Taiki](https://forum.mattermost.com/u/Taiki)\
**Post date:** [April 5, 2023, 6:08pm UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/1 "2023-04-05T18:08:02Z")

</div>

**Summary**  
I am attempting to deploy Mattermost according to the manual provided on the official website ([Install Mattermost Omnibus — Mattermost documentation](https://docs.mattermost.com/install/installing-mattermost-omnibus.html)). However, I am encountering issues in achieving two objectives:

1. Enable HTTPS
2. Use port 80 instead of 8065

**Environment**

- Amazon Lightsail
- Ubuntu 22.04 LTS

**Steps to reproduce**

1. Run the following command in the terminal:

```auto
$ curl -o- https://deb.packages.mattermost.com/repo-setup.sh | sudo bash

```

1. Install Mattermost Omnibus by running the following command:

```auto
$ sudo apt install mattermost-omnibus -y

```

1. Enter the domain and email address when prompted.
2. Access the domain.

access to my domain

**Expected Behavior**.

1. The website should be accessible at `https://example.com/`.
2. If accessed at `http://example.com/`, the website should redirect to `https://example.com`.

**Observed behavior**

I am only able to access the website at `http://example.com:8065`, and not on port 80. and I can’t use https.

**What I tried**

I tried changing the settings from the web console, but I was unable to make any changes. Here is a screenshot of the error:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/1/1917f4b08583fa2f7e6ae6fb0c246d236a5a1638.png)

I also tried changing the settings from the file `/etc/mattermost/mmomni.mattermost.env`, but the changes were not saved. After rebooting, the files were restored to their original state.

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [April 6, 2023, 4:04am UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/2 "2023-04-06T04:04:07Z")

</div>

Hey @Taiki and welcome to the Mattermost forums!

The omnibus setup comes with SSL enabled by default as it uses Let’s encrypt. Could it be that there has been an error with the Let’s encrypt certificate generation during the setup or did you maybe answer the question if you want to have Let’s encrypt with no?

When you change settings in `/etc/mattermost/mmomni.mattermost.env` you need to restart Mattermost, so that it recognizes the new environment variables, but please do not touch this file for now and instead please run `mmomni reconfigure` and post the output here.

---

<div class="post-metadata">

**Author:** ![Taiki](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/taiki/32/6657_2.png) [@Taiki](https://forum.mattermost.com/u/Taiki)\
**Post date:** [April 6, 2023, 4:57am UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/3 "2023-04-06T04:57:46Z")

</div>

> [@agriesser](#):
>
> please do not touch this file for now and instead please run `mmomni reconfigure` and post the output here.

@agriesser  
Thank you for your reply.  
This is output. “Generate SSL Certificate” has been skipped.

```auto
$ sudo mmomni reconfigure
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [localhost] ***************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************
ok: [localhost]

TASK [Update debconf variables with json file values] **************************************************************************************
ok: [localhost] => (item={'key': 'mattermost-omnibus/domain', 'value': 'example.jp'})
ok: [localhost] => (item={'key': 'mattermost-omnibus/email', 'value': 'mail@gmail.com'})

TASK [Ensure that NGINX is running] ********************************************************************************************************
ok: [localhost]

TASK [Check if certificate already exists] *************************************************************************************************
ok: [localhost]

TASK [Generate SSL Certificate] ************************************************************************************************************
skipping: [localhost]

TASK [Renew SSL certificate] ***************************************************************************************************************
changed: [localhost]

TASK [Configure NGINX https template] ******************************************************************************************************
ok: [localhost]

TASK [Delete default NGINX configuration file] *********************************************************************************************
ok: [localhost]

TASK [Restart NGINX service with the new configuration] ************************************************************************************
changed: [localhost]

TASK [Create database user] ****************************************************************************************************************
ok: [localhost]

TASK [Create database for Mattermost] ******************************************************************************************************
ok: [localhost]

TASK [Create system user] ******************************************************************************************************************
ok: [localhost]

TASK [Ensure file permissions] *************************************************************************************************************
ok: [localhost] => (item=/opt/mattermost)
ok: [localhost] => (item=/var/opt/mattermost/data)
ok: [localhost] => (item=/var/log/mattermost)

TASK [Generate mattermost env variables] ***************************************************************************************************
ok: [localhost]

TASK [Generate systemd service] ************************************************************************************************************
ok: [localhost]

TASK [Enable and restart Mattermost service] ***********************************************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************************************************************************
localhost : ok=15 changed=3 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0   

```

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [April 6, 2023, 5:23am UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/4 "2023-04-06T05:23:58Z")

</div>

OK, interesting. Please provide more outputs (all with sudo or in a root shell and I’ve added examples of what it should look like):

Check if nginx is running and listening on port 443:

```auto
# lsof -i :443
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 362823 root 8u IPv4 6810358 0t0 TCP *:https (LISTEN)
nginx 362823 root 9u IPv6 6810359 0t0 TCP *:https (LISTEN)
nginx 362824 nginx 8u IPv4 6810358 0t0 TCP *:https (LISTEN)
nginx 362824 nginx 9u IPv6 6810359 0t0 TCP *:https (LISTEN)
nginx 362825 nginx 8u IPv4 6810358 0t0 TCP *:https (LISTEN)
nginx 362825 nginx 9u IPv6 6810359 0t0 TCP *:https (LISTEN)

```

Verify that the certificates have been generated and are configured in nginx:

```auto
# grep ssl_certificate /etc/nginx/conf.d/mattermost.conf
    ssl_certificate /etc/letsencrypt/live/mmtest2.anexia.dev/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mmtest2.anexia.dev/privkey.pem;

```

Restart nginx and post the last few lines of the log:

```auto
# systemctl restart nginx
# tail -50 /var/log/nginx/error.log

```

---

<div class="post-metadata">

**Author:** ![Taiki](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/taiki/32/6657_2.png) [@Taiki](https://forum.mattermost.com/u/Taiki)\
**Post date:** [April 6, 2023, 5:52am UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/5 "2023-04-06T05:52:02Z")

</div>

Thank you.  
First, I try `sudo lsof -i :443`. As I was checking, I noticed something. So I checked the Lightsail console and found that port 443 was not allowed. I reconfigured and restarted Lightsail. Then everything was resolved.  
Thanks for your support.

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [April 7, 2023, 7:33am UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/6 "2023-04-07T07:33:35Z")

</div>

Awesome, thanks for letting us know and glad to hear you’re up and running now 🙂

---

<div class="post-metadata">

**Author:** ![Greg\_V](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Greg\_V](https://forum.mattermost.com/u/Greg_V)\
**Post date:** [January 28, 2024, 2:16pm UTC](https://forum.mattermost.com/t/unable-to-enable-https-and-change-port-in-mattermost-omnibus-deployment/15595/7 "2024-01-28T14:16:01Z")

</div>

@agriesser sorry for crashing this thread. I recently installed Omnibus but opted out of https (because I was have having issues by trying to install it with https) and used "sudo MMO\_HTTPS=false apt install mattermost-omnibus " when installing. Now that everything is up and running, I’d like to switch over to https, how do I go about that? The only instructions I found were for the System Console, which doesn’t work for me as everything was set through an environment variable.
