如何使用Lego生成覆盖多域名变体的Let's Encrypt证书?
Hey there! Let me share what I know about your two questions from working with Lego and Let's Encrypt on Bitnami servers:
1. Can I use a comma-separated list of domains in the Lego command?
Absolutely! This is actually the standard way to include multiple domain variants (like your .com, .co.uk, and www subdomains) in a single Let's Encrypt certificate.
Just format the --domains flag with all your desired domains separated by commas (no spaces needed). Here's an example of what that command would look like:
sudo lego --email="your-email@example.com" --domains="example.com,www.example.com,example.co.uk,www.example.co.uk" --path="/etc/lego" run
This will generate a single certificate that covers all those domains as Subject Alternative Names (SANs), so you won't need separate certificates for each variant.
2. What's the naming rule for the .crt and .key files in /etc/lego/certificates? Will there be overly long filenames?
No need to worry about long filenames here! Lego uses the first domain you specify in the --domains list as the base name for both the certificate and key files.
For example, if your command starts with --domains="example.com,...", the files will be named:
example.com.crtexample.com.key
Even if you add 10 more domains after the first one, the filenames will still stay short and based on that initial domain. The certificate itself will include all your specified domains as SANs, but the filename doesn't reflect that—so no unwieldy, overly long names to deal with.
内容的提问来源于stack exchange,提问作者Lee Probert

