
正文
nginx多ip多端口多域名方式
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
目录
-
一:Nginx虚拟主机
- 1.基于ip的方式
- 2、基于多端口的方式
- 3、基于多域名的方式
一: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;
}
}







