'How can I enable SSL / HTTPS on a NextCloud instance self-hosted with Docker on my home server (Pop!_OS / Ubuntu)?

I have installed Docker and used it to build a container for this official NextCloud Docker Image.

I was able to install NextCloud and serve it on localhost:8080. However, I want to serve this NextCloud instance externally so I can access it from outside of my home network. In order to do that I need to enable HTTPS. As far as I can tell the Docker Image is using an apache server.

How can I enable this container/app to use HTTPS so I can access it externally?

Here is a screenshot of NextCloud running on localhost:8080 open to its "Administration > Overview" page in which it shows me security warnings including the need for HTTPS: enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source