Hello!
I am working on new project and I have idea to provide free sub-domain for each registered user.
I want users to have their unique sub-domain, also they should be able to change A or NS for their sub-domain, if possible. I don’t need any sub-directories for them, just a domain, so they could use it for their own needs for free. Example: user.mydomain.com
So question, is it even possible here in DigitalOcean? And if it is, could you give me some tips or tutorials how to set it up? It can be done by DigitalOcean API? I am new to this. Thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
I done it! Just what I wanted. Maybe this will be useful for someone, I was coding quickly, without any validations and so this more like an example, but it’s working, here is how I done it.
First of all, I use Laravel 5. But this will work for anyone who has Guzzle 4.0+ (doesn’t work on 6.0+).
In controller.
Digital Ocean is BEST!! <3
Yes, managing A records for subdomains be done using the API. I set up a similar setup for a project of mine not long ago. Here is what I did.
This will allow the user to change their A record to point to any IP address.
Currently our DNS system does not support subdomain NS records so using this method would not allow your users to set up NS records to delegate their subdomain to another DNS server. If that is a requirement you would have to look into setting up nameservers using BIND or another DNS server and write the code to modify those records.
Documentation on managing records within a domain via the API.
This comment has been deleted