How to implement multi-tenant virtual host?

problem description

does Github pages use name-based virtual hosts technology?
how is it implemented when multiple users use multiple domain names under the same ip such as github pages?

the environmental background of the problems and what methods you have tried

Does

really create a github pages and add a block of configuration code to the server"s configuration file while moving the compiled static files to the set directory?

expected results?

does github pages implement a "routing" mechanism in Java or any business language when implementing this function?

the platform version of the problem and what methods you have tried

Apr.11,2021

google: nginx dynamic configuration.


The Nginx, used by

GitHub can check the server_name configuration item. After
Nginx receives the HTTP request, the process is roughly as follows:

  1. remove the requested port
  2. find the corresponding IP address array according to the port number
  3. find the corresponding array of IP addresses, and then query the domain name hash table. If not, use the configuration of the current IP address. If found, use the configuration of the domain name

the rule for finding a domain name is:

  1. if there is an exact match, a domain name that matches exactly is returned. For example, the request domain name is www.test.com, server_name . The configured value is www.test.com
  2. .
  3. if forward matching is satisfied, return the domain name of forward match. For example, the request domain name is login.test.com, server_name . The configured value is * .test.com
  4. .
  5. if the backward match is satisfied, the domain name of the backward match is returned. For example, the request domain name is www.test.org, server_name . The configured value is www.test.*
  6. .
Menu