So nginx-1.15.9 was released very recently with the following change:
Feature: variables support in the "ssl_certificate" and "ssl_certificate_key" directives.
I setup an instance with multiple domains pointing to the following server block. I am using dehydrated to generate the certs automatically and in their own respective folders.
However, despite trying several variations and googling for various solutions, I am not having any success in having the variables in the "ssl_certificate" and "ssl_certificate_key" directives being recognised.
- Have verified that the certs are generated correctly (with fullchain.pem and privkey.pem)
 - The error I'm getting from navigating to the https URL directly: Secure Connection Failed
 - https works perfectly if I update the "$server_name" to the actual domain folder containing the certs
 
Appreciate if someone could take a look at my server block to identify what I'm doing wrong or point me in the correct direction. Thank you.
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    root /var/www/html;
    index index.php index.html index.htm;
    server_name _;
    # ssl on;
    ssl_certificate /etc/dehydrated/certs/$server_name/fullchain.pem;
    ssl_certificate_key /etc/dehydrated/certs/$server_name/privkey.pem;
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/run/php/php7.2-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }
    location ~ /\.ht {
        deny all;
    }
}