I have a project in mind that will offer users their own domain, like tumblr does for example.

I want to find a provider that can provide:

  • One top domain. eg: myproject.com
  • Unlimited subdomains. eg: a.myproject.com, b.myproject.com, ...
  • An API to create subdomains automatically
  • At a reasonable price (if possible).

2 Answers 2


If your DNS provider supports wildcard records, then you just need a web host that supports arbitrary subdomains with name-based virtual hosting.

This is a perfectly fine and scalable way to set up a family of subdomains. For example, it's what StackExchange does: they just have a single wildcard DNS A record for *.stackexchange.com, which (currently) points to The webserver running on that address then looks at the HTTP Host header to decide which site to serve.

  • That is a really good idea. This server that reads the header to decide redirection can new subdomains be added with out restarting it?
    – eliocs
    Commented Mar 20, 2012 at 8:52
  • Certainly; for example, see superuser.com/questions/192686/…. Also, one way to implement this, if you're e.g. serving the content dynamically from a database, is to have the server map all domains to the same root directory and just have the scripts in that directory check the Host header. Commented Mar 20, 2012 at 10:45

Creating individual A records for each account is one method. I worry about the propagation possibly being delayed.

In my zend application when users register they are asked to choose a user name, that name becomes their sub-domain name where they login. username.myapp.com The username is placed into a file /etc/nginx/subdomains

There is a perl script in the Nginx conf folder that reads the list of subdomains from the file and enters them as server names or aliases I forget which. Nginx is then reloaded with nginx -s reload this reloads the configuration files only, nginx (the web server) never goes down. So before the users even get to activating their email address and logging in their sub-domain is ready without having to use DNS records.

The application does validation when a user logs in at their domain it checks they are logging into their assigned sub-domain.

With this if people enter a sub-domain that doesn't exist they see a custom 404. Similar to if you go to http://asdfasdfasdfasdfa.zendesk.com/

If my application ends up with 100,000 users I rather not have to worry about 100,000 A records and simply work off a local database and file to manage the sub-domains.

  • If you don't use the wildcard DNS record, how is your DNS configured?
    – eliocs
    Commented Mar 20, 2012 at 9:17
  • My mistake, I just logged into Amazon Route53 the application server which handles all the logins has a wildcard. But nginx and the application handles the sub-domains so that it's not allowing people to access just any sub-domain.
    – Anagio
    Commented Mar 20, 2012 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.