Fork me on GitHub

nginx反向代理配置

修改host文件(来实现域名访问)

1
2
192.168.170.128 8081.zyx.com
192.168.170.128 8082.zyx.com

安装两个tomcat实例并修改端口

修改nginx配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
upstream tomcatserver1 {
server 192.168.170.128:8080;
}
upstream tomcatserver2 {
server 192.168.170.128:8081;
}
server {
listen 80;
server_name 8081.zyx.com;
location / {
proxy_pass http://tomcatserver1;
index index.html index.htm;
}
}
server {
listen 80;
server_name 8082.zyx.com;
location / {
proxy_pass http://tomcatserver2;
index index.html index.htm;
}
}
-------------本文结束感谢您的阅读-------------
坚持原创技术分享,您的支持将鼓励我继续创作!