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 "test.com";
        ~^(?<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 "test.com"; -> not work
                    #if ($domain != "test.com"){
                    #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


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.

  • the problem and that the system can receive the request name.domain.dot or private.dot how to run all ssl? Loading 1k + ssl would not affect performance? github.com/openresty/lua-nginx-module could not be the solution? – Felipe Kusk Feb 11 at 21:59
  • ok, certbot certonly --rsa-key-size 4096 --webroot --agree-tos --no-eff-email --email dot@gmail.com -w /usr/local/nginx/html -d name.domain.dot -d domain.dot -d other.dot -d -d -d? would be the solution? – Felipe Kusk Feb 11 at 22:03
  • That's pretty much the way I do it. Keep in mind that Let's Encrypt limits you to 100 names per certificate. – Michael Hampton Feb 11 at 22:12
  • but then how do you get to 1k? – Felipe Kusk Feb 11 at 22:30
  • @FelipeKusk Use wildcard certs or different server blocks. – Michael Hampton Feb 12 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.