Article From:https://segmentfault.com/q/1010000012152381
Question:

Using nginx to configure pan domain parsing
*.xxx.com
So that a.xxx.com b.xxx.com can be accessed
I separately configured an independent two level domain name
m.xxx.com cannot access
How to resolve pan domain name resolution? How do you not affect the configured two level domain name?

Answer 0:

There is no need to exclude the two level domain names that have been matched, because the matching order of server_name is like this.

  1. Match the exact server_name, which is the two level domain name that you have configured.
  2. Match the server_name that starts with * wildcards, that is, the pan domain name that you set up.
  3. Match the server_name that ends with a * wildcard
  4. regular expression matching
  5. The above four do not match, determine whether to set default.
  6. No default is set, and the previous rules are configured to take effect

The priority ranges from high to low, and any one is matched to stop matching. The configured two level domain name handles the highest priority, so there is no need to do any exclusion.

Answer 1:

Because server_name is precisely matched, the most accurate example is:
server_name .a.com
server_name b.a.com
When accessing the b.a.com domain name, it will match to server_name b.a.com.
When accessing the b.a.com domain name, it will match to server_name.A.com.

Leave a Reply

Your email address will not be published. Required fields are marked *