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

 

posted @ 2020-02-26 17:51  Rolay  阅读(2179)  评论(0编辑  收藏  举报