【nginx】 基本的 WebSocket 的配置

Nginx 配置

server {
  listen 80;
  server_name danmulive.qibashe.dev;

  location / {
    proxy_pass http://127.0.0.1:9995/;
    proxy_redirect off;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}

Reload Nginx 然后从浏览器控制台尝试链接, OK

new WebSocket('ws://danmulive.qibashe.test')

 

posted @ 2017-09-25 17:37  蓝色星辰1993  阅读(120)  评论(0编辑  收藏  举报