Assume I have a domain http://go.example.com/abcdefg
when example.com
is server running on NGINX. The main task of that server is to proxy pass all visitors to other server and then, this other server redirects person to specific, predefined link (fetched from database).
I am planning on creating interface that will allow them to add their own domain. These domains will be stored in database (mysql in my case), and the NGINX config file will be created based on the domain name user specified earlier using predefined template in sites-enabled folder. Same goes for deletion.
Once user adds either A or CNAME records to his domain (whichever works best, perhaps you can explain me what works best in this case?) that will point to specific IP address or domain, his domain should become accessible and behave the same way, go.example.com
does.
For example, assume user added domain http://foo.com
, then all user accessing http://foo.com/abcdefg
will redirect to the same link, go.example.com/abcdefg
does.
What I am trying to achieve is allow users to override our domain name, and use their own instead that will behave exactly as our original domain. This process needs to be controlled so the domain name could be disabled if needed.
I am asking if this is the proper way to go or perhaps there is a better way to automate "domain parking"?