-1

This is a best practices question. I'm working on starting a site that will have user generated subdomains that host user content. Think tumbler or stackexchange. subdomains like *.mysite.com where sub1.mysite.com will point to a service running on a port.

Currently my idea is to have my DNS provider point a wildcard record *.mysite.com to a static ip address that has an nginx running. I would then create nginx config files for each one of the subdomains and map to the correct port.

My concerns with this solution are that it can become rather cumbersome and to maintain a large amount of config files for subdomains. I'm not sure on nginx's reload time if this could be a bottle neck reloading the server to add new subdomain mappings.

Another approach I had was to use a dynamic DNS provider that had an api for creating subdomains and make a subdomain record on the fly when a new service is created. I couldn't find any stellar services out there for this and also the DNS propagation would be a problem.

1
  • 2
    The thing you should be searching for is nginx mass virtual hosting.
    – Zoredache
    Jan 3, 2014 at 2:18

1 Answer 1

1

You're confused on how wildcard DNS works. You don't map DNS to port numbers, DNS maps to an IP address. So a wildcard DNS record takes all unknown names and sends them to a particular IP. It doesn't matter whether I type "serviceA.mysite.com" or "thisisamadeupdomainthatdoesntexist.mysite.com" - if they're both not current DNS entries, I'll get sent to the same IP, no matter what port I'm using.

On your server, you can decide what happens to traffic based on port using nginx or another load balancer/proxy. But the domain name has no impact on that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .