By C K
I’m working on a webapp where users can connect their profile to their domains, but how do I enable wildcard dns in digitalocean? Using vhosts or from the domain panel? Eg: If the user profile is https://webapp.com/user It will be shown on https://user.com/ once the user connects the domain.
I’m using
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
@Cybil Here is the approach I would take:
webapp.com
without any subdomains to the DO Control Panel. *
is the host name and your droplet is selected as the target so that all subdomains route Now the DNS record is directing all subdomain URL requests (user1.webapp.com
, user2.webapp.com
) to your Droplet. To ensure the root domain is also pointing to webapp.com, add an @
A-Record too.
Note: From our documentation:
(Use) A wildcard (*). To direct requests for a non-existent subdomain to a server or load balancer, enter *. However, if any kind of DNS record exists for a hostname, the wildcard will not apply; you will need to explicitly create an A record for it. https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/#a-records
mod_vhost_alias
extension on Apache with sudo a2enmod vhost_alias
and then restart Apache with systemctl restart apache2
# ROOT DOMAIN CONFIG
<VirtualHost *:80>
ServerName webapp.com
DocumentRoot /path/to/webapp
</VirtualHost>
#DYNAMIC SUBDOMAIN CONFIG
<VirtualHost *:80>
ServerAlias *.webapp.com
VirtualDocumentRoot /path/to/webapp/users/%1.php
</VirtualHost>
Lastly restart apache again with systemctl restart apache2
Hi,
Maybe you want to say https://users.webapp.com? Your question is to add subdomains for every user and enable https access?
Maybe you can turn to acme.sh and it will redirect to a GitHub repo with more information on setting up https. At there you can find what you want.
As for wildcard subdomains, just add *.webapp.com
in your DNS console. That means, *
is the record, and YOUR SERVER IP is the value.
Regards, Shiroka
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.