diff --git a/demos/nginx-1.14.0/conf/demos/demo02.conf b/demos/nginx-1.14.0/conf/demos/demo02.conf new file mode 100644 index 0000000..d8fc9ea --- /dev/null +++ b/demos/nginx-1.14.0/conf/demos/demo02.conf @@ -0,0 +1,26 @@ +#设定负载均衡的服务器列表 +upstream demo02-server { + # weigth参数表示权值,权值越高被分配到的几率越大 + server 127.0.0.1:9011 weight=5; + server 127.0.0.1:9012 weight=1; + server 127.0.0.1:9013 weight=6; +} + +server { + listen 80; + server_name www.demo02.com; + + charset utf-8; + proxy_connect_timeout 180; + proxy_send_timeout 180; + proxy_read_timeout 180; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + + # root /home/nginx/demos; + root ../../../javaapp/src/main/webapp; + + location / { + proxy_pass http://demo02-server; + } +} diff --git a/demos/nginx-1.14.0/conf/nginx.conf b/demos/nginx-1.14.0/conf/nginx.conf index e4f28b8..0a88cf2 100644 --- a/demos/nginx-1.14.0/conf/nginx.conf +++ b/demos/nginx-1.14.0/conf/nginx.conf @@ -21,8 +21,8 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; include mime.types; include demos/*.conf;