apachemod-rewritecloudflarelets-encryptispconfig

Automatic lets encrypt SSL certificate for wildcard subdomain


I am using ISPConfig as hosting panel on my Centos VPS Machine and Cloudflare for DNS management.

I have added the following rewrite rules to my vhost which automatically reroutes sub-folders to sub-domains.

Code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain.com
RewriteCond %{HTTP_HOST} ^(www\.)?(([^\.]+)\.){1}domain..com$
RewriteCond /var/www/backoffice.ge/web/build/%3 -d

All works fine and perfect on http (*80), but i have certificate issue on https (*443). Based on my workaround, issue is in Let's Encrypt certificate which is generated for main domain only (domain.com).

If possible, i want to create universal wildcard certificate which will automatically work for all sub domains, or create sub domain/directory certificates on the fly via PHP.

I have found some articles about Certbot. But, not sure how to make it work for the above setup.


Solution

  • Found Solution, works perfectly with my ispconfig setup. i have generated wildcard certificate and all sub-domains have ssl.

    https://bjornjohansen.no/wildcard-certificate-letsencrypt-cloudflare