For example: a.example.com/index.html corresponds to /a-direcoty/index.html, while b.example.com/index.html Corresponds to /b-direcoty/index.html
a.example.com/index.html
/a-direcoty/index.html
b.example.com/index.html
/b-direcoty/index.html
人生最曼妙的风景,竟是内心的淡定与从容!
server { listen 80; server_name ~^(?<subdomain>.+).example.com$; index index.html index.htm; root /$subdomain-direcoty/; }
nginx configuration file can set the server segment, and set server_name in the server to specify the domain name. So in this case, set up two servers, one with two domain names, and then set root as a specific directory
nginx configuration file can set the server segment, and set server_name in the server to specify the domain name. So in this case, set up two servers, one with two domain names, and then set root as a specific directory