nginx websocket代理配置

map $http_upgrade $connection_upgrade {
        default upgrade;
        ‘‘ close;
    }

   upstream linecloudwebsocket {
        server 127.0.0.1:9002;
    }
server{
   listen       80;
   server_name  localhost;    
    location /linecloud/socket {
             rewrite ^/linecloud/socket(.*)$ /$1 break;
            proxy_pass http://linecloudwebsocket;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }
}

相关推荐