# How to enable or connect SSL from host to Docker Mautic container

**URL:** https://forum.mautic.org/t/how-to-enable-or-connect-ssl-from-host-to-docker-mautic-container/20306
**Category:** Product Support
**Tags:** mautic-3
**Created:** [July 29, 2021, 9:27am UTC](https://forum.mautic.org/t/how-to-enable-or-connect-ssl-from-host-to-docker-mautic-container/20306 "2021-07-29T09:27:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hhjchen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/hhjchen/32/2326_2.png) [@hhjchen](https://forum.mautic.org/u/hhjchen)
#### Post date: [July 29, 2021, 9:27am UTC](https://forum.mautic.org/t/how-to-enable-or-connect-ssl-from-host-to-docker-mautic-container/20306/1 "2021-07-29T09:27:55Z")

</div>

**Your software**  
My Mautic version is: Mautic 3.3.3 (in a Docker container running on DigitalOcean host w/Apache2)  
My PHP version is: PHP 7.3.27  
My Database type and version is: MySQL5.7

**Your problem**  
My problem is:  
I can access Mautic OK at [http://serverIP:8080](http://serverIP:8080) but I would like it to work also for https.

I suppose the issue I’m having requires some Docker expertise, so I’m hoping there are Docker experts or at least those who have worked with Docker Mautic in this community. There is a similar question on the Docker Mautic Github, but unfortunately, no inputs.

All I’m trying to do is enable SSL for my Mautic instance that is running in a Docker container. I was able to get LetsEncrypt certificate installed successfully on the host, but I’m still having issues trying to enable or connect it for the Mautic container. I read many different posts but most are using Ngnix and basically I’m going from one rabbit hole to another. Seems like this should be straightforward, but I’m missing something.

**These errors are showing in the log:**  
Just can’t access Mautic using https.

**Steps I have tried to fix the problem:**  
Created the SSL certificates.

These files were created:  
/etc/letsencrypt/live/domain\_name/fullchain.pem  
/etc/letsencrypt/live/domain\_name/privatekey.pem  
/etc/apache2/sites-available/mydomain-le-ssl.conf

I ran `netstat -tulpen` on the host and it shows port 80 and 443 listening.

In my docker-compose.yml file, I’ve added the binding of port 8443:443 to the Mautic container. I’ve also tried to mount the volumes, and perhaps this is where I’m not doing it right.

```auto
ports:
      - 8080:80
      - 8443:443
  volumes:
      - mautic_data:/var/www/html
      - /etc/letsencrypt/live/mydomain.com:/etc/ssl/certs

```

Am I going in the right direction at all?

Is the mapping of port 443 ok?

For the volumes, should I mount the certificates to the` /etc/ssl/certs` directory inside the container? And am I mounting it correctly in the docker-compose file? Is mounting enough or do I need to somehow copy the SSL certificates from the host into the container?

Is there anything else I need to do? What am I missing?

---

<div class="post-metadata">

### Author: ![mchojrin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mchojrin/32/10159_2.png) [@mchojrin](https://forum.mautic.org/u/mchojrin)
#### Post date: [July 18, 2023, 9:57am UTC](https://forum.mautic.org/t/how-to-enable-or-connect-ssl-from-host-to-docker-mautic-container/20306/2 "2023-07-18T09:57:09Z")

</div>

Hey, if anyone runs into this issue, I posted [this solution in Github](https://github.com/mautic/docker-mautic/issues/191#issuecomment-1634728367).

The basic idea is to install certbot on the hosting server and create a new docker image based on the original mautic one.

In this new image you’ll reference the files created by certbot to enable ssl.

In the GitHub issue referenced at the beginning of this post you’ll find the Dockerfile, Makefile and every other detail needed to sort this out.

---

<div class="post-metadata">

### Author: ![abioluz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/abioluz/32/13473_2.png) [@abioluz](https://forum.mautic.org/u/abioluz)
#### Post date: [March 29, 2025, 7:12pm UTC](https://forum.mautic.org/t/how-to-enable-or-connect-ssl-from-host-to-docker-mautic-container/20306/3 "2025-03-29T19:12:15Z")

</div>

I created a yml in which I have already configured the SSL for installation in coolify, it may help someone else [mautic5-ssl.yml](https://github.com/abioluz/coolify-apps/blob/d83bce27d85949c2185fc999bb9aa5446bc7a6e8/docker-compose/mautic5-ssl.yml)

* * *

Eu criei um yml em que já configura o SSL para instalação no coolify, pode ser que ajude mais alguém [mautic5-ssl.yml](https://github.com/abioluz/coolify-apps/blob/d83bce27d85949c2185fc999bb9aa5446bc7a6e8/docker-compose/mautic5-ssl.yml)
