

Let’s start by creating an empty directory which will contain our certificates:

Because that does not take care of certificates, we will use LetsEncrypt companion container for nginx-proxy to set up and maintain Let’s Encrypt certificates. We will use nginx-proxy as our reverse proxy.
#There were too many requests of a given type letsencrypt free
Let’s encrypt is a free certificate authority which certifies that you are the owner of your domain. If it is the web servers that are hidden (in this case Drupal or the html containers), we use the term “reverse proxy”. Why “reverse”? The term “proxy” is already used and means that the web user is hidden from the server. The Drupal and html containers are effectively hidden in front of a proxy. In our case we want to have a webserver container which represents our Drupal and html containers. The term “proxy” means something which represents something else. Step three: a reverse proxy and Let’s encrypt Now you have two running sites, but they’re not yet accessible to the outside world. Port mapping will be the responsibility of the reverse proxy (more on that later). We do not want to map our containers’ ports directly to our host ports using -p 80:80 -p 443:443 because we will have more than one app using the same port (the secure 443). Start by making sure you have two domains which point to your server, in this example we’ll use: Step two: Set up two domains or subdomains you own and point them to your server In this tutorial we will serve two different sites, one simple HTML site and one Drupal site, each using standard ports, on the same Docker host, using a reverse proxy, a container which sits in front of your other containers and directs traffic. This will not work on localhost, because in order to use Let’s Encrypt, you need to demonstrate ownership over your domain(s) to the outside world. To follow along, create a new virtual machine (VM) with Docker, for example using the “Docker” distribution in the “One-click apps” section of Digital Ocean. This article is about serving your Drupal Docker container, and/or any other container, via https with a valid Let’s encrypt SSL certificate.Įdit: if you’re having trouble with Docker-Compose, read this follow-up post.
