🔖 nginx demo

pull/2/head
Zhang Peng 2018-07-04 23:10:59 +08:00
parent 53a209b76d
commit c09b291761
2 changed files with 28 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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;