Custom TLS Certificate
To replace the self-signed certificate cert.crt with the key cert.key with your own,
you need to mount the certificate and key:
-
Create a YML file named
docker-compose.cert.ymlwith the following content:services: nginx: volumes: - ./example.com.crt:/etc/nginx/cert.crt:ro - ./example.com.key:/etc/nginx/cert.key:ro -
Add
docker-compose.cert.ymlto theCOMPOSE_FILElist in the.envfile:sed -i 's/^COMPOSE_FILE=\(.*\)$/COMPOSE_FILE=\1:docker-compose.cert.yml/' .env -
Restart the Nginx service:
docker-compose rm -s nginx && docker-compose up -d nginx