Implementing HTTPS locally with Docker Compose
When it comes to implementing HTTPS, most of the work is going to be achieved through NGINX. Although we have worked a little with NGINX, the NGINX configuration is a powerful tool. You can implement conditional logic, pull variables and data from the request and act on them, redirect traffic, and much more. In this chapter, we are going to do enough to implement HTTPS, but it is advised that, if you have time, read up on the fundamentals of NGINX configurations; reading material is provided in the Further reading section. For our NGINX .conf file, we have the following layout:
#ingress/nginx.conf
events {
worker_connections 512;
}
http {
server {
. . .
}
server {
. . .
}
}
Here, we can see that we have two server scopes in our http scope. This is because we need to enforce HTTPS. We must remember that our outside port is 80. However, if we want to carry out an HTTPS connection, we instead...