1. 程式人生 > >nginx負載均衡與反向代理配置

nginx負載均衡與反向代理配置

upstream 193.168.81.128{
    server localhost:8080 weight=1 max_fails=2 fail_timeout=30s;
    server localhost:8081 weight=1 max_fails=2 fail_timeout=30s;
    keepalive 300; # 300個長連線
    }

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    location / {
       # root   /usr/share/nginx/html;
       # index  index.html index.htm;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         proxy_pass http://192.168.81.128;
    }
}