nginx多ip多端口多域名方式

一:Nginx虚拟主机

  • 基于多IP的方式
    • 基于多端口的方式
      • 基于多域名的方式
1.基于ip的方式
[root@web01 conf.d]# cat game2.conf 
server {
    listen 80;
    server_name 192.168.15.7;
    location / {
	root /opt/Super_Marie;
        index index.html;
    }
}
server {
    listen 80;
    server_name 172.16.1.7;
    location / {
        root /opt/tank;
        index index.html;
    }
}
2、基于多端口的方式
[root@web01 conf.d]# cat game3.conf 
server {
    listen 80;
    server_name 192.168.15.7;
    location / {
        root /opt/Super_Marie;
        index index.html;
    }
}
server {
    listen 81;
    server_name 192.168.15.7;
    location / {
        root /opt/tank;
        index index.html;
    }
}

3、基于多域名的方式
[root@web01 conf.d]# cat game4.conf 
server {
    listen 80;
    server_name www.game.com;
    location / {
        root /opt/Super_Marie;
        index index.html;
    }
}
server {
    listen 80;
    server_name www.game1.com;
    location / {
        root /opt/tank;
        index index.html;
    }
}
posted @ 2022-01-04 18:39  AlexEvans  阅读(293)  评论(0编辑  收藏  举报