nginx 反代ws协议进行im在线聊天的 websocket协议

   location /im-api/ {
        proxy_redirect off;
        proxy_pass http://172.26.71.51:9218/;      # 转发
        proxy_set_header Host $host;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
        proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;   # 升级协议头 websocket
        proxy_set_header Connection upgrade;
            proxy_set_header Connection $connection_upgrade;
          }

展开阅读剩余部分