websocket 配置 https 连接

websocket 地址 

'wss://hongonew.com/hone/web/websocket/';

 

nginx 配置

server {
        listen       443 ssl;
        server_name  hongonew.com;
			
		ssl on;
        ssl_certificate      **;
        ssl_certificate_key  **;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
		
		
		  location ~/hone/{
              proxy_pass http://127.0.0.1:8080;
              index  dashboard index; 

              #websocket额外配置开始
			  proxy_http_version 1.1;
			  proxy_set_header Upgrade $http_upgrade;
			  proxy_set_header Connection "upgrade";
			  proxy_connect_timeout 60s;#l连接超时时间,不能设置太长会浪费连接资源
	          proxy_read_timeout 500s;#读超时时间
	          proxy_send_timeout 500s;#写超时时间
              #websocket额外配置结束

              proxy_set_header Host       $http_host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
              proxy_set_header X-Forwarded-Proto $scheme;
	    } 
		
      
		
		access_log  logs/https_access.log;
		error_log  logs/https_error.log;
    }

 

转载于:https://my.oschina.net/u/3387320/blog/3080884

你可能感兴趣的:(websocket 配置 https 连接)