Hosting custom domains with IP address flexibility
- by F21
I am building a small service where users will be assigned a subdomain such as:
myusername.myservice.com
anotheruser.myservice.com
I know that I can set up a wildcard vhost and using some configuration regex, serve the files like so:
myusername.myservice.com ===> /var/www/myusername
anotherusername.myservice.com ===> /var/www/anotherusername
The problem is that I would like to allow users to alias their own domain names to their service.
I understand that for the webserver, once the user adds the domain via my web interface, I can easily create a vhost for the domain in nginx and then refresh the webserver.
The problem is that I would prefer to NOT let the users add an A record of my webserver's IP address as I would prefer to keep things flexible (when we upgrade our infrastructure to something more complex to scale).
What is the best way to achieve this?