current position:Home>Netty configures WSS protocol access through nginx (Practical)

Netty configures WSS protocol access through nginx (Practical)

2022-04-29 08:26:23Ocean Java

First write a relatively simple , Write another article later Vue + springboot +netty 

Netty In the Internet and Internet of things companies use a lot , The bottom floor is still websocket agreement , Many advantages , Not one by one , There are many related articles , You can search it ;

In the actual development and Application , Basically, the front and rear ends are separated , Front end deployment requires the help of nginx, So in general nginx To configure https, wss that will do , No additional configuration is required in the code , Here is nginx Profile details :

server {

        #listen  80; # Here I put http and https The two requests are separated , in order to http Automatically jump to https
        server_name;# Change your domain name here 
        listen 443 ssl;

        ssl_certificate  /usr/local/11.pem;# Change your certificate here , The certificate is a free certificate applied by Alibaba cloud 
        ssl_certificate_key   /usr/local/11.key;# Change your certificate here 
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        location /ws {
            # Here is a separate netty  Service ip And port , Change to your own 
            proxy_set_header X-Real-IP $remote_addr;

copyright notice
author[Ocean Java],Please bring the original link to reprint, thank you.