How to use lego CLI to generate
Executing lego run
will look like this:
$ cd .../some/where
$ lego --domains example.com [some options omitted] run
This will create a directory .../some/where/.lego/certificates
:
$ ls .lego/certificates
example.com.crt example.com.issuer.crt example.com.json example.com.key
where:
$domain.crt
is the server certificate (including the CA certificate; equivalent to fullchain.pem
)$domain.key
it the server certificates' private key and key (= privkey.pem
),$domain.issuer.crt
is only the CA certificate, and$domain.json
contains some meta information.Notes:
.lego
directory can be changed by explicitly adding a --path
flag (like lego --path /opt/lego/ ...
)..crt
and the .key
file are PEM encoded (they're just text files), the file extension (usually) doesn't matter.Notes to self:
--fullchain
flag to auto-generate the aforementioned full chain file@mhf-ir: I'm sorry, I've misread the code. Lego actually already writes the full chain to $domain.crt
. I've updated my answer above: you don't need to cat domain.issuer.crt domain.crt > domain.fullchain.crt
.
Most helpful comment
Executing
lego run
will look like this:This will create a directory
.../some/where/.lego/certificates
:where:
$domain.crt
is the server certificate (including the CA certificate; equivalent tofullchain.pem
)$domain.key
it the server certificates' private key and key (=privkey.pem
),$domain.issuer.crt
is only the CA certificate, and$domain.json
contains some meta information.Notes:
.lego
directory can be changed by explicitly adding a--path
flag (likelego --path /opt/lego/ ...
)..crt
and the.key
file are PEM encoded (they're just text files), the file extension (usually) doesn't matter.