premise
- I have a certificate containing the pan-domain name (
* .example.com
andexample.com
); - my purpose nginx, all example.com primary and secondary domain names use this certificate;
implementation
method 1: verification passed, but too much redundant code
each matching domain name loads a certificate, which is too cumbersome, because the certificate is all the same
.-sharp server_name
server {
listen 443;
server_name *.example.com example.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
}
-sharp example.com
server {
listen 443;
server_name example.com;
location / {
...
}
}
-sharp aaa.example.com
server {
listen 443;
server_name aaa.example.com;
location / {
...
}
}
-sharp bbb.example.com
server {
listen 443;
server_name bbb.example.com;
location / {
...
}
}
question
how to load certificates without encumbrance (all certificates follow a unified path)?