Nginx启用WebSocket支持

  1. 报错内容
  2. nginx.conf
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    Nginx启用WebSocket支持_第1张图片

  3. 问题解决
  4. WebSocket跨域
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Credentials' 'true';

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