PEM/KEY certificate¶
The .pem and .key files, containing respectively the certificate and the private key in text/Base64 format, must be placed on the host in the folder:
This folder is mounted in the Nginx container at the following location:
For example, if you have the following files:
exemplecom.cerexemplecom.key
You can use them in your virtual host with the following directives:
💡 Tip: If you use the same certificate in several virtual hosts, I advise creating a snippet to avoid duplicating the configuration.
# file: snippets/ssl-exemplecom.conf ssl_certificate /ssl/exemplecom.cer; ssl_certificate_key /ssl/exemplecom.key;You can then include this snippet in the virtual hosts concerned:
This method centralizes the certificate configuration and simplifies replacing or changing it.