nginx ssl websocket

不才
2019-11-14 04:52:25
map $http_upgrade $connection_upgrade {  
    default upgrade;  
    '' close;  
}

server {
  listen 443 ssl;
  server_name lattice.notbucai.com;

  ssl_certificate /etc/nginx/keys/lattice/ssl.crt;
  ssl_certificate_key /etc/nginx/keys/lattice/ssl.key;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:!eNULL;
  ssl_prefer_server_ciphers on;

  location / {
    proxy_pass http://bucai-lattice:2293;
    proxy_set_header Origin $http_HEADER_Origin;
    proxy_read_timeout 18000;
    proxy_set_header Upgrade $http_upgrade;  
    proxy_set_header Connection "Upgrade";  
  }

}
server {
    listen 80;
    server_name lattice.notbucai.com;
    rewrite ^(.*)$ https://$host$1 permanent;
}