nginx – Dynamically and automatically give out SSL certificates for new domains

I have a service that allows others to bring their own domains for. Currently, the system goes as follows:

  1. User points their domain to our servers
  2. User sends domain to us
  3. We run a custom add command on the server
  4. The add command then automatically setups all of our nginx config and uses certbot to get them a certificate

We would like to automate this process, so a user does not have to send us the link or enter it into some kind of field for the add command to be ran. We would also like to not spam our nginx config, and use a more efficient approach (currently we just add a server block for each domain with the certs). I would like to streamline this and compact it, but I am not super familiar with nginx right now.
Goal: Automatically register ssl for new (user brought) domains

Read more here: Source link