Nginx 1.15.8 need load 1k+ ssl cert

Felipe Kusk asked:

erro ->  nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/$sslwww/fullchain.pem")

the configuration with map or with if are not working what I can do for them to work?

do not just find the path to the file

     map $http_host $sslwww {
        default "";
        ~^(?<subdomain>([\w-]+\.)*)?(?<domain>.+)$ $domain;

            server {
                        listen 80;
                        listen [::]:80;
                        return 301 https://$host$request_uri;

        server {
                    listen       443 ssl http2;
                    listen       [::]:443 ssl http2;
                    server_name ~^(?<subdomain>([\w-]+\.)*)?(?<domain>.+)$;
                    #set $sslwww ""; -> not work
                    #if ($domain != ""){
                    #set $sslwww $domain;
                    ssl_certificate "/etc/letsencrypt/live/$sslwww/fullchain.pem";

Where am I going wrong?

in use include conf but I think it would not be good. what another solution to load 1k ssl cert

My answer:

You can’t use a variable for an ssl_certificate as you could for the server name or many other things. That’s because the certificate must be loaded with the configuration and cannot vary dynamically with each request, as other variables can.

To fix the problem you will need to obtain new TLS certificates with multiple names or wildcards.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.