My partner and I are developing an Angular 10 web application that creates a new subdomain per user (e.g. User: John. Subdomain: john.domain.com). The thing here is that we are using Nginx inside a docker container, and I have no idea how to dynamically generate those subdomains.
Since I don't know how to create those dynamic subdomains I'm not quite sure If I should create a new angular app for the users websites or use the same angular app for both, the users website and our projects website.
I read in another question that the right configuration for my nginx.conf should look like this:
server
{
root /sites/$http_host;
server_name $http_host;
...
}
But then he adds:
I like this as I can literally create sites on the fly, just create new directory named after the domain and point the DNS to the server ip.
This is where I get completely lost. I know what a DNS is and what they do, as well as IP's, but I have no idea how to dynamically create those new directories as well as point the DNS' to them. A friend told me something about bash scripting to add the directories but I'm not quite sure.
I would appreciate any help or guidance, I am completely lost.