1
Prepare the environment
First, create the necessary directories:
2
Configure Nginx
Next, create Nginx’s configuration file with the following content:
letsencrypt/nginx-conf/nginx.conf
Replace
api.example.com
and app.example.com
with your domain name, and remember to point the domain to the server’s IP address.3
Start the container
Then, start the Nginx container to handle the ACME challenge:
4
Retrieve the certificates
Now, run Certbot to obtain the Let’s Encrypt certificate:
Replace the email and domain name with your information.
You should see a message indicating that the certificate was successfully obtained.
5
Remove the container
After obtaining the certificate, stop and remove the temporary Nginx container:
6
Set the auto-renewal
Next, set up auto-renewal by creating a script named Make the script executable and add a cron job to run it twice daily:
renew_cert.sh
:renew_cert.sh
Please replace
/path/to
with the actual path to the directories.Replace
/path/to
with the actual path to the script.7
Finalize settings and run the process
Finally, find the Envoy container in your compose file, mount the Let’s Encrypt certificates, and open port
443
.