zoukankan      html  css  js  c++  java
  • websocket ssl 配置 404 问题

    ailed: Error during WebSocket handshake: Unexpected response code: 404
    ssl_certificate /usr/local/nginx/cert/2075610_beihaoyuewen.com.pem; ssl_certificate_key /usr/local/nginx/cert/2075610_beihaoyuewen.com.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; location /wss/ { proxy_pass http://127.0.0.1:8011/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; } location / { proxy_pass http://www.beihaoyuewen.com; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; } }

      ws 也要求用ssl,前端页面需要改成wss;

     //判断当前浏览器是否支持WebSocket
        if ('WebSocket' in window) {
            websocket = new WebSocket("${ws}://${websocketPath}websocket/"+timestamp);
        }
        else {
            alert('当前浏览器  Not support websocket');
        }
    

      正确配置,双域名:只验证了lpwyx域名,剩下的应该也没问题:

    ssl.conf

    server {
        listen 443 ssl;
        server_name www.lpwyx.com;
        ssl_certificate /usr/local/nginx/cert/2720230_lpwyx.com.pem;
        ssl_certificate_key /usr/local/nginx/cert/2720230_lpwyx.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers   on;
    
        location / {
           proxy_pass http://www.lpwyx.com;
    proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "Upgrade";
         proxy_set_header X-real-ip $remote_addr;
         proxy_set_header X-Forwarded-For $remote_addr;
        }
    }
    server {
        listen 443 ssl;
        server_name www.beihaoyuewen.com;
        ssl_certificate /usr/local/nginx/cert/2075610_beihaoyuewen.com.pem;
        ssl_certificate_key /usr/local/nginx/cert/2075610_beihaoyuewen.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
        ssl_prefer_server_ciphers on;
    
        location / {
           proxy_pass http://www.beihaoyuewen.com;
    proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "Upgrade";
         proxy_set_header X-real-ip $remote_addr;
         proxy_set_header X-Forwarded-For $remote_addr;
        }
    
    }
    

      参考:

    https://blog.csdn.net/qq_35808136/article/details/89677749

    www.beicaiduo.com
  • 相关阅读:
    php无限极分类
    HDU 1176 免费馅饼 (类似数字三角形的题,很经典,值得仔细理解的dp思维)
    HDU 1158(非常好的锻炼DP思维的题目,非常经典)
    HDU 1165 公式推导题
    HDU 1069 Monkey and Banana(转换成LIS,做法很值得学习)
    HDU 1059(多重背包加二进制优化)
    HDU 1058(打表)
    oracle11g之管理oracle数据库笔记(理论基础知识)
    oracle11g之Oracle体系结构(理论基础知识)
    HDU 1025 LIS二分优化
  • 原文地址:https://www.cnblogs.com/hoge66/p/11828291.html
Copyright © 2011-2022 走看看