Multiple domain with SSL - Proxy Pass

Assume I have 100 domains.
I want to proxy pass these domains to

I tried the following

server_name ${host}
listen 443;
ssl_certificate /etc/letsencrypt/live/${host}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${host}/privkey.pem;
include /etc/letsencrypt/live/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {

Please suggest if this implementation is correct?

Hi @elg, and welcome to the LE community forum :slight_smile:

Although this question is unrelated to the purpose of this forum, I will point out one thing (and provide you with a working example).

Based on your example:
${host} would assume the values [,,, ...]
Using proxy_pass${host};
The resulting path should be like:
Your request was for it to be like:

The "www" is easily added or removed.
The ".com" is not as easy to remove; but it can be removed with a bit more cleverness:

server_name ~^(?<subdomain>\w+)\.com$;

Feel free to send me a :beer:


Thank you for helping out.
I am now using virtual hosts.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.