0

I have a site where users can point their own custom domain to their unique directory on my site through A Records.

For example, example.com points to mysite.com/something and anothersite.org points to mysite.com/somethingelse

Each of these custom domains has an SSL certificate generated for them however is there a way to point to them dynamically in the VirtualHost file?

SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

domain.com should be the current domain - if someone visits example.com then that should be where domain.com is.

Is it possible to use variables somehow?

I have tried this but it doesn't work and causes an error: SSLCertificateFile /etc/letsencrypt/live/%{HTTP_HOST}/fullchain.pem

There is one only virtual host in total as there are hundreds of custom domains.

Osman
  • 97
  • 1
  • Did you ever find a solution to this? Looking for the exact same thing. – wiggles Nov 14 '20 at 21:45
  • @wiggles Can't remember exactly, but basically instead of having one virtual host file I had a separate one created dynamically for each domain. – Osman Nov 15 '20 at 22:46
  • That's what's I've gone with too – wiggles Nov 16 '20 at 02:28
  • @wiggles There is hardly any information on this subject even though so many websites seem to have the feature. I am still unsure if the dynamic virtual hosts are efficient – Osman Nov 16 '20 at 21:01
  • Exactly my thoughts. I guess we'll have to find out the hard way – wiggles Nov 18 '20 at 01:21

0 Answers0