Hacker News new | ask | show | jobs
by mod 4211 days ago
The latter is what you want here, most likely.
1 comments

Ah yes, this is exactly what I needed. I did not know that you could do that until today. Thanks! Do you know if it's possible to exclude domains part of the wildcard in nginx (e.g. blog.mysite.com or forum.mysite.com):

http://kbeezie.com/wildcard-subdomains-php/

Do you mean via DNS or via PHP/HTTP?

With DNS the wildcard is treated last. So if you define forums.* and blog.* to point to a specific server or CNAME, when those are requested that is the result which will be returned. Everything that has not been handled expressly will then hit the wildcard and be resolved as defined (explicit before implicit).

With the HTTP server you'd just define rules ahead of the wildcard. For example, forums.* and blog.* would be handled first and anything which hasn't been handled at all is defaulted to whatever your wildcard handling-site is.

This is pretty easy to do in at least Apache and IIS (just have your wildcard site as the default, and then define the hostname of everything else). The PHP code just reads in whatever is in the request header and handles it logically internally.

PS - I like Route53 but it is expensive. Also set up billing alerts(!).