-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme.rd
More file actions
40 lines (34 loc) · 896 Bytes
/
readme.rd
File metadata and controls
40 lines (34 loc) · 896 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
@2018-04-28
Swagger2集成
------
Nginx测试接口,Nginx的配置可参考reference/nginx.conf
第一步,修改Nginx配置文件
++
upstream springboot_server{
server localhost:8080 weight=20;
server localhost:8081 weight=40;
server localhost:8082 weight=60;
}
server {
location / {
proxy_pass http://springboot_server;
root html;
index index.html index.htm;
}
...
}
++
第二步,启动三个服务实例
++
../kjoy>mvn install -Dmaven.test.skip=true
../kjoy>java -jar target/kjoy-0.0.1-SNAPSHOT.jar --server.port=8080
../kjoy>java -jar target/kjoy-0.0.1-SNAPSHOT.jar --server.port=8081
../kjoy>java -jar target/kjoy-0.0.1-SNAPSHOT.jar --server.port=8082
++
第三步,打开浏览器测试
http://localhost/nginx/whereami
不断刷新以上地址结果如下(但出现的几率不一样):
You are on port 8082.
You are on port 8081.
You are on port 8080.
------