Deploying with AWS. Enable HTTPS connections

I did everything according to the instructions from the chapter “Deploying AWS”. But I have a little problem. When I connect to the server via HTTP, everything works fine. But when I use HTTPS, the browser gives the error Safari can't open the page "https://<server_api>/" because Safari can't connect to the server "<server_api>".

Inbound rules look correct

This is my first server application. And I don’t understand where I could have made a mistake. I will be grateful for your help.

UPD: It looks like I realized what the error was. I need an SSL certificate. You need to perform the following steps:

sudo su -
apt-get install snapd
sudo snap install core; sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --nginx

Then you answer Certbot questions. At the last step, when you are asked to enter the domain name, there is one important nuance. You cannot use the DNS name that AWS provides to you (for example ecX-X-XXX-XXX-XX.us-east-2.compute.amazonaws.com). This is written here. You need to get a free domain or buy it on some resource like https://www.namecheap.com

You can read more about this in the official documentation
https://docs.vapor.codes/4.0/deploy/nginx/#tls

Amazon EC2 instances are just virtual machines so you would setup SSL the same way you would set it up on any server.

You don’t mention what platform you are on, so it difficult to give any more information.

If you’ve purchased and configured a custom domain name for your Elastic Beanstalk environment, you can use HTTPS to allow users to connect to your web site securely. If you don’t own a domain name, you can still use HTTPS with a self-signed certificate for development and testing purposes. HTTPS is a must for any application that transmits user data or login information.
The simplest way to use HTTPS with an Elastic Beanstalk environment is to assign a server certificate to your environment’s load balancer. When you configure your load balancer to terminate HTTPS, the connection between the client and the load balancer is secure. Backend connections between the load balancer and EC2 instances use HTTP, so no additional configuration of the instances is required.

iMessage App