Zerowallet
Search
K

Setting up the HTTPS server

Option 1 : ELB

With AWS Elastic Beanstalk, you can quickly deploy and manage applications in the AWS Cloud without having to learn about the infrastructure that runs those applications.
If you are not familiar with ELB, you can see Getting started using Elastic Beanstalk.
You can deploy your server on Elastic Beanstalk, as it supports the deployment of web applications from Docker containers.
In order to deploy your server using Elastic Beanstalk, you can follow the official AWS tutorial for deploying applications from Docker containers.
Once you have your server deployed on Elastic Beanstalk, you can follow up with AWS official Configuring HTTPS with Elastic Beanstalk tutorial.

Option 2 : Nginx

The second option is to use Nginx, we already set it up inside the docker container, so you don't have to worry about Configuring it. You just need to follow the steps below:

1- Adding certificate and key

In order to create a secure connection with the user’s browser, we’ll need to obtain a digital certificate and a private key. Normally, you get the certificate from a certificate authority such as Let’s Encrypt. Make sure to install the certificate using Certbot, which will take care of reconfiguring NGINX for you.
For local development you can also create a self-signed certificate. The only problem is that browsers will show a warning that the “Certificate is not Trusted” when someone visits your website. But for testing on your local machine that’s perfectly fine.
As you can see in your project root directory, we have two main directories, nginx and server. Once you have your certificate and private key, you need to add them to nginx directory with the following names:
  • cert.pem for the certificate
  • key.pem for the private key

2- Building docker-compose

Once you have your private key and ssl certificate in nginx directory, all you need is to build the docker-compose
sudo docker-compose up --build
That’s it!
Now, if you access https://localhost:443, your connection will be secure.
Note that our default https port is 443, you can change that by replacing the listen port in default.conf, inside server component.
For more information, check out Configuring HTTPS servers with NGINX.