# Variables in ssl\_certificate

**URL:** <https://www.ruby-forum.com/t/variables-in-ssl-certificate/208539>\
**Category:** NGINX\
**Created:** [June 21, 2011, 1:38am UTC](https://www.ruby-forum.com/t/variables-in-ssl-certificate/208539 "2011-06-21T01:38:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [June 21, 2011, 1:38am UTC](https://www.ruby-forum.com/t/variables-in-ssl-certificate/208539/1 "2011-06-21T01:38:59Z")

</div>

Hi there,

So that I can run identical configurations on many servers, I would like  
to  
abstract my nginx configuration down by doing this in my SSL “server”  
stanza:

```
ssl_certificate /etc/ssl/${server_name}.pem;

```

However, nginx won’t interpret this variable, causing this error:  
Restarting nginx: [emerg]:  
SSL\_CTX\_use\_certificate\_chain\_file(“/etc/ssl/${server\_name}.pem”) failed

Is it possible to use variables in ssl\_certificate in this way? Ideally  
I’d  
even like to use a “map” but this doesn’t get interpreted either. ☹

## TIA, Matt.

Matt Saunders 07506 857125  
[http://www.yoyo.org/matts/contacts/](http://www.yoyo.org/matts/contacts/)

---

<div class="post-metadata">

**Author:** ![Matt\_Saunders](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@Matt\_Saunders](https://www.ruby-forum.com/u/Matt_Saunders)\
**Post date:** [June 22, 2011, 6:12am UTC](https://www.ruby-forum.com/t/variables-in-ssl-certificate/208539/2 "2011-06-22T06:12:42Z")

</div>

I think the best way is write a config generator by yourself with  
velocity or freemarker

Posted at Nginx Forum:

> **[Re: Variables in ssl\_certificate](https://forum.nginx.org/read.php?2,208615,208912#msg-208912)**
>
> Hi there, So that I can run identical configurations on many servers, I would like to abstract my nginx configuration down by doing this in my SSL "server" stanza: ssl\_certificate /etc/ssl/${server\_name}.pem; However, nginx won't
