
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
   listen       443 ssl;
   server_name  xxx.com;

   ssl_certificate      ssl/_.im199.com.crt;
   ssl_certificate_key  ssl/_.im199.com.key;

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

   ssl_ciphers  HIGH:!aNULL:!MD5;
   ssl_prefer_server_ciphers  on;

   location /api {
        proxy_pass http://localhost:8082/api/;
    }

    location /ws {
        proxy_pass http://localhost:8899/ws;   # ws结尾不带"/"，实际请求服务器时不会去掉"/ws"
        proxy_set_header Upgrade $http_upgrade;   # 升级协议头
        proxy_set_header Connection upgrade; # 升级长连接协议头
    }

   location / {
       root   html;
       index  index.html index.htm;
   }
}