nginx配置websocket代理

在location匹配配置中添加如下内容:

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "Upgrade";

示例如下:

upstream socket {

    server 10.0.12.108:9000;

    server 10.0.12.109:9000;

}

 location / {

            proxy_http_version 1.1;

            proxy_set_header Upgrade $http_upgrade;

            proxy_set_header Connection "upgrade";

            proxy_pass http://socket;

 

        }

你可能感兴趣的:(websocket,nginx)