Is it possible to configure dynamic SSL certificate path in nginx same as like dynamic virtual host.
ssl_certificate and ssl_certificate_key are not accepting the variables in nginx.
Thanks
Using the API for Dynamic Configuration The NGINX Plus REST API supports the following HTTP methods: GET – Display information about an upstream group or individual server in it. POST – Add a server to the upstream group. PATCH – Modify the parameters of a particular server.
To set up an HTTPS server, in your nginx. conf file include the ssl parameter to the listen directive in the server block, then specify the locations of the server certificate and private key files: server { listen 443 ssl; server_name www.example.com; ssl_certificate www. example.com.
Unfortunately, it's not possible because nginx needs to load the whole SSL server configuration at start time.
Source: https://t37.net/the-good-the-bad-and-the-ugly-of-virtual-hosting-with-nginx.html
Since Nginx version 1.15.9 variables are supported in "ssl_certificate" and "ssl_certificate_key" directives.
You can load them dynamically by using lua. You need to figure out how you want to map and fetch them though.
Here is an example of loading them from a database: https://github.com/Vestorly/nginx-dynamic-ssl/blob/master/conf/nginx.conf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With