Netty通过Nginx配置wss
协议
离婚协议模板下载合伙人协议 下载渠道分销协议免费下载敬业协议下载授课协议下载
访问(实践可行) 先写个比较简单的,后面再写一篇Vue+springboot+netty Netty在互联网以及物联网公司用的很多,底层走的还是websocket协议,好处很多,就不一一列了,相关的文章很多,大家可以搜下;在实际开发应用中,基本上都是采用前后端分离,前端部署需要借助nginx,所以一般在nginx配置https,wss即可,代码中不需要另外配置,下面是nginx配置文件详情:server{#listen80;#我这里把http和https两种请求分开了,为了http能自动跳转到httpsserver_nametest.baidu.com;#这里换成自己的域名listen443ssl;ssl_certificate/usr/local/11.pem;#这里换成自己的证书,证书是阿里云申请的免费的证书ssl_certificate_key/usr/local/11.key;#这里换成自己的证书ssl_session_timeout5m;ssl_ciphersECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocolsTLSv1TLSv1.1TLSv1.2;ssl_prefer_server_cipherson;location/ws{#这里是单独的netty服务的ip和端口,换成自己的就proxy_passhttp://172.2.2.1:8081;proxy_set_headerX-Real-IP$remote_addr;proxy_bufferingoff;proxy_connect_timeout30;proxy_send_timeout330;proxy_read_timeout330;proxy_redirectdefault;proxy_http_version1.1;proxy_set_headerHost$host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_headerUpgrade$http_upgrade;#proxy_set_headerConnectionkeep-alive;#proxy_cache_bypass$http_upgrade;}}大家有疑问可以给我留言,或者关注我公众号,给我留言 关注博主即可阅读全文 -全文完-