美文网首页
socket.io遇上https

socket.io遇上https

作者: 四季变幻 | 来源:发表于2018-06-18 23:05 被阅读19次

    https直播室连接文字服务器时会报错,因为文字服务器的地址一般是http的,利用nginx(或其他)给文字服务器地址加层代理即可,例如:

    server {

    listen      443 ssl;

    server_name  180.178.45.98;

    location / {

    proxy_pass http://112.74.162.39:9011;

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection "upgrade";

    }

    }

    应该这样:

    server {

    listen      443 ssl;

    server_name  www.xxx.com;

    ssl_certificate      C:/nginx-1.14.0/conf/ssl/full_chain.pem;

    ssl_certificate_key  C:/nginx-1.14.0/conf/ssl/private.key;

    ssl_session_cache    shared:SSL:1m;

    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;

    ssl_prefer_server_ciphers  on;

    location /socket {

    proxy_pass http://112.74.162.39:9011;

    proxy_http_version 1.1;

    proxy_set_header Upgrade $http_upgrade;

    proxy_set_header Connection "upgrade";

    }

    location / {

      proxy_pass http://103.224.248.72:8080/;

    }

    }

    相关文章

      网友评论

          本文标题:socket.io遇上https

          本文链接:https://www.haomeiwen.com/subject/dijoeftx.html