🔖 调整示例中的端口号
parent
6b6e8446ff
commit
cfbf2d947d
|
@ -1,5 +1,5 @@
|
||||||
upstream demo01-server {
|
upstream demo01-server {
|
||||||
server 127.0.0.1:9001;
|
server 127.0.0.1:9010;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#设定负载均衡的服务器列表
|
#设定负载均衡的服务器列表
|
||||||
upstream demo02-server {
|
upstream demo02-server {
|
||||||
# weigth参数表示权值,权值越高被分配到的几率越大
|
# weigth参数表示权值,权值越高被分配到的几率越大
|
||||||
server 127.0.0.1:9011 weight=5;
|
server 127.0.0.1:9021 weight=5;
|
||||||
server 127.0.0.1:9012 weight=1;
|
server 127.0.0.1:9022 weight=1;
|
||||||
server 127.0.0.1:9013 weight=6;
|
server 127.0.0.1:9023 weight=6;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
rem -------------------------------------------------
|
rem -------------------------------------------------
|
||||||
rem 启动 Demo1
|
rem 启动 Demo1
|
||||||
rem 1. 启动 Nginx
|
rem 1. 启动 Nginx
|
||||||
rem 2. 启动一个 JavaApp,访问地址为:localhost:9001
|
rem 2. 启动一个 JavaApp,访问地址为:localhost:9010
|
||||||
rem -------------------------------------------------
|
rem -------------------------------------------------
|
||||||
@echo off
|
@echo off
|
||||||
echo ">>>> 1. Start nginx"
|
echo ">>>> 1. Start nginx"
|
||||||
cd "../nginx-1.14.0"
|
cd "../nginx-1.14.0"
|
||||||
call nginx-start.bat
|
call nginx-start.bat
|
||||||
|
|
||||||
echo ">>>> 2. Start javaapp - localhost:9001"
|
echo ">>>> 2. Start javaapp - localhost:9010"
|
||||||
cd "../javaapp"
|
cd "../javaapp"
|
||||||
java -Dtomcat.connector.port=9001 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
java -Dtomcat.connector.port=9010 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,20 +2,20 @@ rem ----------------------------------------------------------------------------
|
||||||
rem Demo02 - 负载均衡配置(Nginx/demos/nginx-1.14.0/conf/demos/demo02.conf)
|
rem Demo02 - 负载均衡配置(Nginx/demos/nginx-1.14.0/conf/demos/demo02.conf)
|
||||||
rem 1. 启动 Nginx
|
rem 1. 启动 Nginx
|
||||||
rem 2. 启动三个 JavaApp,访问地址分别为:
|
rem 2. 启动三个 JavaApp,访问地址分别为:
|
||||||
rem localhost:9011
|
rem localhost:9021
|
||||||
rem localhost:9012
|
rem localhost:9022
|
||||||
rem localhost:9013
|
rem localhost:9023
|
||||||
rem -----------------------------------------------------------------------------
|
rem -----------------------------------------------------------------------------
|
||||||
@echo off
|
@echo off
|
||||||
echo ">>>> 1. Start nginx"
|
echo ">>>> 1. Start nginx"
|
||||||
cd "../nginx-1.14.0"
|
cd "../nginx-1.14.0"
|
||||||
call nginx-start.bat
|
call nginx-start.bat
|
||||||
|
|
||||||
echo ">>>> 2. Start 3 java app: localhost:9011/localhost:9012/localhost:9013"
|
echo ">>>> 2. Start 3 java app: localhost:9021, localhost:9022, localhost:9023"
|
||||||
cd "../javaapp"
|
cd "../javaapp"
|
||||||
start /min java -Dtomcat.connector.port=9011 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
start /min java -Dtomcat.connector.port=9021 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
start /min java -Dtomcat.connector.port=9012 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
start /min java -Dtomcat.connector.port=9022 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
start /min java -Dtomcat.connector.port=9013 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
start /min java -Dtomcat.connector.port=9023 -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
pause
|
pause
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,15 @@ rem Demo03 - 网站有多个 webapp 的配置(Nginx/demos/nginx-1.14.0/conf/d
|
||||||
rem 1. 启动 Nginx
|
rem 1. 启动 Nginx
|
||||||
rem 2. 启动三个 JavaApp,访问地址分别为:
|
rem 2. 启动三个 JavaApp,访问地址分别为:
|
||||||
rem localhost:9030/
|
rem localhost:9030/
|
||||||
rem localhost:9032/product
|
rem localhost:9031/product
|
||||||
rem localhost:9033/user
|
rem localhost:9032/user
|
||||||
rem -----------------------------------------------------------------------------
|
rem -----------------------------------------------------------------------------
|
||||||
@echo off
|
@echo off
|
||||||
echo ">>>> 1. Start nginx"
|
echo ">>>> 1. Start nginx"
|
||||||
cd "../nginx-1.14.0"
|
cd "../nginx-1.14.0"
|
||||||
call nginx-start.bat
|
call nginx-start.bat
|
||||||
|
|
||||||
echo ">>>> 2. Start 3 java app: localhost:9030、localhost:9031/product、localhost:9032/user"
|
echo ">>>> 2. Start 3 java app: localhost:9030, localhost:9031/product, localhost:9032/user"
|
||||||
cd "../javaapp"
|
cd "../javaapp"
|
||||||
start /min java -Dtomcat.connector.port=9030 -Dtomcat.context.path=/ -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
start /min java -Dtomcat.connector.port=9030 -Dtomcat.context.path=/ -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
start /min java -Dtomcat.connector.port=9031 -Dtomcat.context.path=/product -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
start /min java -Dtomcat.connector.port=9031 -Dtomcat.context.path=/product -cp "target/JavaWebApp/WEB-INF/classes;target/JavaWebApp/WEB-INF/lib/*" io.github.dunwu.app.Main
|
||||||
|
|
Loading…
Reference in New Issue