How to install Let's Encrypt SSL certificate with CHT 4.0.0 Alpha Nginx container

Hi,

I am running CHT 4.0.0 Alpha.
I installed the Let’s Encrypt SSL certificate on the Nginx docker container by copying my cert.pem and key.pem files into the /etc/nginx/private/ folder on the container.

I am getting the below error. Whats is the best way to use the Let’s Encrypt SSL certificate with the Nginx container? Thanks

root-nginx-1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
root-nginx-1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
root-nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
root-nginx-1 | 10-listen-on-ipv6-by-default.sh: info: IPv6 listen already enabled
root-nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
root-nginx-1 | 20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/server.conf.template to /etc/nginx/conf.d/server.conf
root-nginx-1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/ssl-install.sh
root-nginx-1 | Running SSL certificate checks
root-nginx-1 | CERTIFICATE MODE = SELF_SIGNED
root-nginx-1 | Generating a RSA private key
root-nginx-1 | …++++
root-nginx-1 | …++++
root-nginx-1 | writing new private key to ‘/etc/nginx/private/key.pem’
root-nginx-1 | req: Can’t open “/etc/nginx/private/key.pem” for writing, No such file or directory
root-nginx-1 exited with code 1

1 Like

Hi @munjoma !

I think the problem is this line:

CERTIFICATE MODE = SELF_SIGNED

That mode instructs the nginx container to create a brand new self-signed certificate which you don’t want because you’re providing one of your own. There is a little documentation about the environment variables in the repo, but in short, I think you need to set an environment variable: CERTIFICATE_MODE=OWN_CERT

2 Likes

Hi @gareth

Thanks for the pointers, it worked!!

1 Like