Using $host variable in ssl_certificate path

Sergey Kandaurov pluknet at nginx.com
Wed Oct 20 16:23:36 UTC 2021


> On 20 Oct 2021, at 19:00, dimitre <nginx-forum at forum.nginx.org> wrote:
> 
> hello, I'm trying to use the variable $host in this entry: 
> 
> ssl_certificate /etc/letsencrypt/live/$host/fullchain.pem; 
> ssl_certificate_key /etc/letsencrypt/live/$host/privkey.pem; 
> 
> to potentially make one entry that fits multiple domains, but it is not
> possible 
> I think the variable $host is not parsed in this specific directive 
> 
> nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/$host/fullchain.pem")
> failed (SSL: error:02001002:system library:fopen:No such file or
> directory:fopen('/etc/letsencrypt/live/$host/fullchain.pem','r')
> error:2006D080:BIO routines:BIO_new_file:no such file) 

The error suggests you have too old nginx version.
Variables support in the "ssl_certificate" and "ssl_certificate_key"
directives first appeared in nginx 1.15.9.

-- 
Sergey Kandaurov



More information about the nginx mailing list