nginx configures virtual hosts based on domain names

Configure the server_name parameter in the server section of the configuration file,

http {
  server {
     server_name  www.a.com;
     root   /data/webroot/publica;
     .....
  }

  server {
     server_name  localhost 127.0.0.1 *.b.com
     root   /data/webroot/publicb;
   }

}


Then add the ip mapping file of the operating system
127.0.0.1 www.a.com
127.0.0.1 www.b.com

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326261947&siteId=291194637