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


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.d/ is not empty, will attempt to perform configuration
root-nginx-1 | / Looking for shell scripts in /docker-entrypoint.d/
root-nginx-1 | / Launching /docker-entrypoint.d/
root-nginx-1 | info: IPv6 listen already enabled
root-nginx-1 | / Launching /docker-entrypoint.d/
root-nginx-1 | Running envsubst on /etc/nginx/templates/server.conf.template to /etc/nginx/conf.d/server.conf
root-nginx-1 | / Launching /docker-entrypoint.d/
root-nginx-1 | Running SSL certificate checks
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:


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


Hi @gareth

Thanks for the pointers, it worked!!

1 Like