首页 » 工作 » 方法 » 正文

nginx proxy websocket example

发布者:某某人
2016/09/14 浏览数(1,097) 分类:方法 暂无评论
server {
  listen 80;
  server_name ws.repo;

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

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

upstream ws_server {
  server 127.0.0.1:3000;
}

server {
  listen 80;
  server_name ws.repo;

  location / {
    proxy_pass http://ws_server/;
    proxy_redirect off;

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

官方资料:http://nginx.org/en/docs/http/websocket.html

暂时木有评论啊,等您坐沙发呢!

发表评论

点击返回顶部
  1. 留言
  2. 联系方式